PDA

View Full Version : Write an XML File


Imjake9
04-10-2009, 07:29 PM
I am building a program that will use XML to import and export data. I have already figured out how to extract the data from an XML file and store it in a dataGrid, but I want to be able to write new information to the XML file too. I know how to open the XML file, and I know how to create inline XML with ActionScript, but I can't seem to find a way to

Add elements and text in a certain place in the XML ActionScript variable.
Save the XML variable as an XML file to the user's computer.
And I assume I could also use the writeBytes() or writeUTFBytes() methods to write the file, but I don't know how to do this.

In the Adobe AIR manual, it even has an example entitled: "Reading an XML file into an XML object", but has no information on writing the file! By the way, if you haven't figured out already, I'm using Flash CS4 and ActionScript 3.0.

Thanks in advance,
Jake

EndlessLine
04-15-2009, 11:24 PM
Try using the FileStream class. For adding nodes to your XML file (I'm assuming thats what you need to do) the XML class has methods for accomplishing this. Post some code so we can take a look