03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Integer value Defined constant<br />

8 COMMENT_NODE<br />

9 DOCUMENT_NODE<br />

10 DOCUMENT_TYPE_NOD<br />

E<br />

11 DOCUMENT_FRAGMENT<br />

_NODE<br />

12 NOTATION_NODE<br />

In Flash Player, the XML class only supports node types 1 (ELEMENT_NODE) <strong>and</strong> 3<br />

(TEXT_NODE).<br />

value:String - For a text node, this is the text of the node; for an element node, this is the<br />

contents of the tag.<br />

Example<br />

var ELEMENT_NODE:Number = 1;<br />

var node1:XMLNode = new XMLNode(ELEMENT_NODE, "fullName");<br />

var TEXT_NODE:Number = 3;<br />

var node2:XMLNode = new XMLNode(TEXT_NODE, "Justin Case");<br />

// Create a new XML document<br />

var doc:XML = new XML();<br />

// Create a root node<br />

var rootNode:XMLNode = doc.createElement("root");<br />

// Add the rootNode as the root of the XML document tree<br />

doc.appendChild(rootNode);<br />

// Build the rest of the document:<br />

rootNode.appendChild(node1);<br />

node1.appendChild(node2);<br />

trace(doc);<br />

// Output: Justin Case<br />

XMLNode 1361

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!