Jump to content

Adding A New Bit Of Coding To A Xml File?


migroo

Recommended Posts

Okay I have an xml file that I would like to add on to using php how would I do this?Here is my xml file:

<?xml version='1.0'?><info>  <link>   <icon>New!</icon>   <name>Help me with javascript images!</name>   <auther>Tamuj</auther>   <id>1</id>  </link>  <link>   <icon>New!</icon>   <name>I need to know what is your name?</name>   <auther>Tamuj</auther>   <id>2</id>  </link>  <link>   <icon>Question?</icon>   <name>Do you like the forum?</name>   <auther>Tamuj</auther>   <id>3</id>  </link></info>

I want to add another link block onto the top of the file.How would I go about doing such a thing?The only thing like this I have ever done is delete an entire xml file and replace it with the new code. If any one can help me I would be very happy. :)

Link to comment
Share on other sites

PHP has a DOM API, which is pretty much the same as in JavaScript. You approach any kind of editing the same way you'd do it for JavaScript. Just remember to save the file in the end with the DOMDocument::save() method.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...