Forum Moderators: coopster

Message Too Old, No Replies

Editing an xml file with php

         

surrealillusions

10:09 pm on Dec 23, 2008 (gmt 0)

10+ Year Member



Hi all,

Simple question really,

Is there a way to edit the current contents of an xml file from an online form? If so, what way would be best?

:)

coopster

10:23 pm on Dec 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



SimpleXML [php.net] and/or DOM [php.net] are my preferred methods. Any XML work I prefer to do on a PHP5 installation. It is truly that much easier and cost-effective.

surrealillusions

10:47 pm on Dec 23, 2008 (gmt 0)

10+ Year Member



Yeah, i use the simpleXML functions to write to the xml file, as in add to it, but i need a way of editing the content thats already in the xml file from an online form.

So, someone can view the current data in there, and choose which block to edit, like

<block>
<news>headline 1</news>
<item>Some stuff goes here. Look at me! i'm at the north pole dressed up as a giraffe.</item>
<subitem>thats not a giraffe, its a gorilla with sunglasses</subitem>
</block>

Each bit, like the news, item and subitem can be edited individually.

coopster

10:50 pm on Dec 23, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Have a look at the DOM functions then, I think they will be your best option.