Help with inserting a node/data to an existing xml file?
I am trying to store this data - this file will be updated periodically and the only parts that I need to add to will be under the <maintenance /> node. That is, <performed /> will be added periodically. I can create this file the first time okay, but on updates the entire file is written again, that is, all the nodes are rewritten.
I have a form that the user fills out and when a save button is clicked, only the <performed /> node and its attributes should be added to this file.
How is this done? - I've just about pulled the remaining strands of hair from my balding brow. If anyone could point me in the right direction, please. Thanks in advance.
Code:
<?xml version="1.0" encoding="utf-8"?>
<automake xmlns="http://tempuri.org/cavalier1.xsd">
<owner>Your Name</owner>
<optional>OptionalData</optional>
<originalmileage>23</originalmileage>
<auto year="2002" make="Ford" model="Mustang" color="Black" />
<maintenance>
<performed date=" " task=" " mileage=" " extradata=" " />
<performed date=" " task=" " mileage=" " extradata=" " />
</maintenance>
</automake>