/*
Programmer: James Tadeo
What: Sample XML object and node in Flash with an attribute.
The
code below will create a simple XML document:
<test type="4">7</test>
*/
//create
the XML object you want to work with
myXML=new XML();
//define the name of the XML node and create it using createElement
//<test></test>
testNode=myXML.createElement("test");
//create an attribute type named 4
//type="4"
testNode.attributes.type=4;
//...after
creating the attibribute, you can now add it to the test node to
get
//<test type="4"></test>
myXML.appendChild(testNode);
//now add the text to the testNode
//first you must create the text
text=myXML.createTextNode("7");
testNode.appendChild(text);
|