|
Flash CS4 Resources |
XML objectsContents [Hide]An XML object may represent an XML element, attribute, comment, processing instruction, or text element. An XML object is classified as having either simple content or complex content . An XML object that has child nodes is classified as having complex content. An XML object is said to have simple content if it is any one of the following: an attribute, a comment, a processing instruction, or a text node. For example, the following XML object contains complex content, including a comment and a processing instruction:
XML.ignoreComments = false;
XML.ignoreProcessingInstructions = false;
var x1:XML =
<order>
<!--This is a comment. -->
<?PROC_INSTR sample ?>
<item id='1'>
<menuName>burger</menuName>
<price>3.95</price>
</item>
<item id='2'>
<menuName>fries</menuName>
<price>1.45</price>
</item>
</order>
As the following example shows, you can now use the comments() and processingInstructions() methods to create new XML objects, a comment and a processing instruction: var x2:XML = x1.comments()[0]; var x3:XML = x1.processingInstructions()[0]; XML propertiesThe XML class has five static properties:
For details on these properties, see the ActionScript 3.0 Language and Components Reference. XML methodsThe following methods allow you to work with the hierarchical structure of XML objects:
The following methods allow you to work with XML object attributes:
The following methods allow you to you work with XML object properties:
The following methods are for working with qualified names and namespaces:
The following methods are for working with and determining certain types of XML content:
The following methods are for conversion to strings and for formatting XML objects:
There are a few additional methods:
For details on these methods, see the ActionScript 3.0 Language and Components Reference. |