PDA

View Full Version : Inserting a block of XML into existing file.


m2244
02-26-2010, 08:09 PM
I have a XML "writer" that not only creates the file on my desktop but it also loads it back in to the "writer". At this point it will add more and more blocks of XML data to the file each time the user enters text into the fields and hits submit. My problem is getting it to add the new blocks of XML before the closing tag. How can I tell it where in the existing file to add the new block of XML? Thanks in advance guys.


<test>
<block1></block1>
<block2></block2>
/*This is where I want to add the new block of XML.*/
</test>

NoobsArePeople2
03-01-2010, 02:13 AM
Read the text from the file into an XML object and use the methods of XML to manipulate the object. When you want to save just write out the XML object with toString().

For reference: http://livedocs.adobe.com/flex/3/langref/XML.html