Re: Export MySQL table to formatted XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No.
Unfortunately I'm newbe to format XML with PHP.

Let's say I have the following XML:

<?xml version="1.0" encoding="utf-8"?>
<fileList>
		<category name="Girls" description="" thumb="" 
allowed="true">
			<image filename="pic1x.jpg" 
<caption>"test"</caption> description="Test" />
			<image filename="pic2.jpg" caption="Test" 
description="Test" />
			<image filename="pic3.jpg" caption="3rd 
pic's caption" description="Description..." />
			<image filename="pic4.jpg" caption="4th 
pic's caption" description="Description..." />
			<image filename="pic5.jpg" caption="5th 
pic's caption" description="Description..." />
			<image filename="pic6.jpg" caption="6th 
pic's caption" description="Description..." />
			<image filename="pic7.jpg" caption="7th 
pic's caption" description="Description..." />
			<image filename="pic8.jpg" caption="8th 
pic's caption" description="Description..." />
		</category>
		<category name="Good Luck" description="" thumb="" 
allowed="true">
			<image filename="pic1x.jpg" caption="1st 
pic's caption" description="Description..." />
			<image filename="pic2.jpg" caption="2nd 
pic's caption" description="Description..." />
			<image filename="pic3.jpg" caption="3rd 
pic's caption" description="Description..." />
			<image filename="pic4.jpg" caption="4th 
pic's caption" description="Description..." />
			<image filename="pic5.jpg" caption="5th 
pic's caption" description="Description..." />
		</category>
		<category name="Lady" description="" thumb="" 
allowed="true">
			<image filename="pic1x.jpg" caption="1st 
pic's caption" description="Description..." />
			<image filename="pic2.jpg" caption="2nd 
pic's caption" description="Description..." />
			<image filename="pic3.jpg" caption="3rd 
pic's caption" description="Description..." />
			<image filename="pic4.jpg" caption="4th 
pic's caption" description="Description..." />
			<image filename="pic5.jpg" caption="5th 
pic's caption" description="Description..." />
			<image filename="pic6.jpg" caption="6th 
pic's caption" description="Description..." />
			<image filename="pic7.jpg" caption="7th 
pic's caption" description="Description..." />
			<image filename="pic8.jpg" caption="8th 
pic's caption" description="Description..." />
		</category>
	</fileList>
</preferences>

How can I open it, edit it by adding a new 
<image filename="pic9.jpg" caption="9th pic's caption" 
description="Description..." />
for example and save back to XML?

BR,
Konstantinos


--- In php-objects@xxxxxxxxxxxxxxx, Alvaro Aguirre Osorio 
<shik_ku@xxxx> wrote:
>
> You try with SimpleXML basic?
> 
> Saludos.
>  --- Konstantinos Christodoulakis
> <alavastros@xxxx> escribió:
> 
> 
> ---------------------------------
> I'm working on an integration between a Flash Gallery
> (which use XML 
> to present photos and data) and an PHP Admin Panel
> (which saves the 
> data in a MySQL database).
> 
> I have a mySQL table named "products" with the
> following columns:
> 
> `products` (
>   `id` int(11) NOT NULL auto_increment,
>  `code` int(11) NOT NULL default '0',
>   `collection` longtext NOT NULL,
>   `product_name` longtext NOT NULL,
>   `caption` longtext NOT NULL,
>   `subtitle` longtext NOT NULL,
>   `price` varchar(100) NOT NULL default '0',
>   `status` int(1) NOT NULL default '0',
>   PRIMARY KEY  (`id`)
> ) ENGINE=MyISAM DEFAULT CHARSET=latin1
> AUTO_INCREMENT=29 ;
> 
> How can I export some of the data to an XML file with
> the following 
> structure, using php ? :
> 
> <?xml version="1.0" encoding="utf-8"?>
> <collection name="xyz" subtitle="xyz" status="xyz">
> <image filename="pic1x.jpg" caption="xyz" />
> etc
> etc
> etc
> </collection>
> 
> I know I may use an Select SQL Query to select the
> data, but how can 
> I map them to XML tags and attributes?
> I'm using your class.mysql_xml PHP Class 
> (http://www.phpclasses.org/browse/package/782.html),
> but the 
> exported XML is the following:
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <table>
>             <ROW>
>                         <ID>26</ID>
>                         <CODE>1234567890</CODE>
>                         <COLLECTION>1</COLLECTION>
>                        
> <PRODUCT_NAME>test</PRODUCT_NAME>
>                         <CAPTION>test</CAPTION>
>                         <SUBTITLE>TEST</SUBTITLE>
>                         <PRICE>100</PRICE>
>                         <STATUS>1</STATUS>
>             </ROW>
> </table>
> 
> 
> 
> 
> 
> 
> 
> PHP Data object relational mapping generator -
> http://www.meta-language.net/
> 
>   
>     
> ---------------------------------
>   YAHOO! GROUPS LINKS
> 
>   
>     Visit your group "php-objects" on the web.
>    
>     To unsubscribe from this group, send an email to:
>  php-objects-unsubscribe@xxxxxxxxxxxxxxx
>    
>     Your use of Yahoo! Groups is subject to the Yahoo!
> Terms of Service.
> 
>   
> ---------------------------------
> 
> 
> 
> 
> 
> 		
> ______________________________________________ 
> Renovamos el Correo Yahoo! 
> Nuevos servicios, más seguridad 
> http://correo.yahoo.es
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux