Reputation: 147
I have the following XML file. I have managed to create a code that adds and removes data. However, I am not able or found anything helpful on how to edit the existing data. My goal is to let the user through a form to write the existing (let's say name) Ben and in another textbox the desired name and submit. I am able to create the form and parse the two vars. Thank you!
the xml
<?xml version="1.0" encoding="utf-8"?>
<messages>
<message time="1248083538">
<name>Ben</name>
<email>Ben's Email</email>
<msg>Bens message</msg>
</message>
<message time="1248083838">
<name>John Smith</name>
<email>[email protected]</email>
<msg>Can you do this for me?</msg>
</message>
</messages>
Upvotes: 1
Views: 301
Reputation: 62894
Don't "modify the XML" -- that implies that you're performing text-operations on it. Possibly using some messy regular expressions and bunch of evil string-functions. If you're not doing that, forgive me.
What you want to do is to:
Lucky for you, SimpleXML, makes doing exactly that nice and easy.
Upvotes: 2