Hi all ,
How do I alter an attribute in an XML file using AS 3.0?
I have the folloiwng XML file:
Code:
<Books>
<Book ISBN="987854">
<title>Sherlock Holmes</title>
<author>Sir Aurthur
</author>
</Book>
<Book ISBN="987854">
<title>Sherlock Holmes</title>
<author>Sir Aurthur</author>
</Book>
<Book ISBN="987854">
<title>Sherlock Holmes
</title>
<author>Sir Aurthur</author>
</Book>
<Book ISBN="987854">
<title>Sherlock Holmes
</title>
<author>Sir Aurthur</author>
</Book>
</Books>
And the following code in AS 3.0:
Code:
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("sampleXML.xml"));
function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
ParseBooks(xmlData);
}
function ParseBooks(bookInput:XML):void {
xxx.text=bookInput.Book.author[0];
}
where xxx is a textbox.
Basically I want to be able to press a button and the AS 3.0 should alter the XML file e.g. change the authors name.
Thanks !
Q