Page 1 of 1

Read Write Edit XML files

Posted: Tue Aug 25, 2009 2:43 pm
by wickidgrafx
I need a very simple script to load an XML file into an html file and be able to edit that datat and then save it back to that file. I have seen similar scripts but they just append data not edit and replace.

Here is a small example of one of the XML files I need to edit.

Code: Select all

<fresh_images>
<image thmb="fresh_images/1_thmb.jpg" big="fresh_images/1.jpg"/>
<image thmb="fresh_images/2_thmb.jpg" big="fresh_images/2.jpg"/>
<image thmb="fresh_images/3_thmb.jpg" big="fresh_images/3.jpg"/>
<image thmb="fresh_images/4_thmb.jpg" big="fresh_images/4.jpg"/>
<image thmb="fresh_images/5_thmb.jpg" big="fresh_images/5.jpg"/>
<image thmb="fresh_images/6_thmb.jpg" big="fresh_images/6.jpg"/>
<image thmb="fresh_images/7_thmb.jpg" big="fresh_images/7.jpg"/>
<image thmb="fresh_images/8_thmb.jpg" big="fresh_images/8.jpg"/>
<image thmb="fresh_images/9_thmb.jpg" big="fresh_images/9.jpg"/>
<image thmb="fresh_images/10_thmb.jpg" big="fresh_images/10.jpg"/>
<image thmb="fresh_images/11_thmb.jpg" big="fresh_images/11.jpg"/>
<image thmb="fresh_images/12_thmb.jpg" big="fresh_images/12.jpg"/>
</fresh_images>
the three XML files I am using are set up the same way. I appreciate and examples or suggestions.

Re: Read Write Edit XML files

Posted: Tue Aug 25, 2009 3:07 pm
by Mark Baker
PHP's simpleXML functions?

Re: Read Write Edit XML files

Posted: Tue Aug 25, 2009 3:13 pm
by wickidgrafx
I looked into SimpleXML but couldn't grasp how to edit information like I stated about. Like I said everything that I found just appended data to the file.

Re: Read Write Edit XML files

Posted: Tue Aug 25, 2009 3:59 pm
by Mark Baker
$xml->movie[0]->characters->character[0]->name = 'Jim Phelps';