XMLnode Class — Internal superclass of the XML class


Flash 5


The XMLnode class defines the core properties and methods of nodes in an XML object hierarchy. Though XMLnode is an internal device, it may be used by programmers to extend the default functionality of XML objects.

Every XML object hierarchy technically includes two kinds of object nodes:

  • One XML node, that serves as the main container for the hierarchy

  • An arbitrary number of XMLnode nodes, which are the children of the main container node

The main container node is an instance of the XML class. For example, if we create myDoc as follows:

myDoc = new XML();

then myDoc is an instance of the XML class. The XML class inherits from the XMLnode class, so main container nodes have all the properties and methods defined by XMLnode plus those defined by XML. By contrast, the children of myDoc would actually be instances of the XMLnode class, not the XML class.

So, if we create myParagraph as follows:

myParagraph = myDoc.createElement("P");

then myParagraph is an instance of the XMLnode class. Most of the time the internal distinction between node classes does not affect our use of XML objects. However, if we wish to add an inherited property or method to all XML objects, then we must use the XMLnode class’s prototype, not the XML class’s prototype (see the example that follows). Any methods or properties attached to XMLnode.prototype are inherited by all XML nodes in a movie.

For reference, the properties, methods, ...

Get ActionScript: The Definitive Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.