View comments | RSS feed

XML objects

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];

Subtopics

XML properties
XML methods

XML properties

The XML class has five static properties:

For details on these properties, see the ActionScript 3.0 Language and Components Reference.

XML methods

The 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.


Flash CS3


Comments


bomby said on Sep 29, 2008 at 7:46 AM :
I would very much like to see throughout the documentation in all books, that if any class, event, method, or property is listed, such as the bulleted listing on this page, that those terms be hotlinked to their corresponding API description. It's rather counter-productive to be reading one of the 'Programming..." books to learn how to use something and be told 'use this to complete your objective' but then have to run a separate search to find it in one of the other 'books'.

Is it being suggested that the purpose of a 'Programming...' book is simply to give the reader suggestions on what to search for instead of directing them to that material?

The last line really underscores this, "For details on these methods, see the ActionScript 3.0 Language and Components Reference." It doesn't even link to the overall topic header in that book to let you start browsing that heirarchy.

Thanks!
brsnyder117 said on Sep 29, 2008 at 9:43 AM :
Thank you for your comment. Unfortunately, for technical reasons that are not worth going into, we were unable to link directly from certain docs to certain other docs in this release. We plan to do a better job in the next release.

Having said that, research with our users has shown that they generally don't like long, bulleted lists in which each entry is a hyperlink. So in this particular case, the "see also" link will take you to the AS3 Language Reference Guide. From there, it is easy to find the XML class (the topic of the current page) by scrolling to the bottom of the class list. One click and you will see all the properties and methods.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/9.0/main/00000125.html