XML


Object
    |
    +-XMLNode
        |
        +-XML

public class XML
extends XMLNode

Use the methods and properties of the XML class to load, parse, send, build, and manipulate XML document trees.

You must use the constructor new XML() to create an XML object before calling any method of the XML class.

An XML document is represented in Flash by the XML class. Each element of the hierarchical document is represented by an XMLNode object.

For information on the following methods and properties, you can see the XMLNode class, specifically appendChild(), attributes, childNodes, cloneNode(), firstChild, hasChildNodes(), insertBefore(), lastChild, nextSibling, nodeName, nodeType, nodeValue, parentNode, previousSibling, removeNode(), and toString().

In earlier versions of the ActionScript Language Reference, the previous methods and properties were documented in the XML class. They are now documented in the XMLNode class.

Note: The XML and XMLNode objects are modeled after the W3C DOM Level 1 recommendation, which you can find at: http://www.w3.org/tr/1998/REC-DOM-Level-1-19981001/level-one-core.html. That recommendation specifies a Node interface and a Document interface. The Document interface inherits from the Node interface and adds methods such as createElement() and createTextNode(). In ActionScript, the XML and XMLNode objects are designed to divide functionality along similar lines.

Availability: ActionScript 1.0; Flash Player 5 - (became a native object in Flash Player 6, which improved performance significantly).

See also

appendChild (XMLNode.appendChild method), attributes (XMLNode.attributes property), childNodes (XMLNode.childNodes property), cloneNode (XMLNode.cloneNode method), firstChild (XMLNode.firstChild property), hasChildNodes (XMLNode.hasChildNodes method), insertBefore (XMLNode.insertBefore method), lastChild (XMLNode.lastChild property), nextSibling (XMLNode.nextSibling property), nodeName (XMLNode.nodeName property), nodeType (XMLNode.nodeType property), nodeValue (XMLNode.nodeValue property), parentNode (XMLNode.parentNode property), previousSibling (XMLNode.previousSibling property), removeNode (XMLNode.removeNode method), toString (XMLNode.toString method)

Property summary

Modifiers

Property

Description

 

contentType:String

The MIME content type that is sent to the server when you call the XML.send() or XML.sendAndLoad() method.

 

docTypeDecl:String

Specifies information about the XML document's DOCTYPE declaration.

 

idMap:Object

An object containing the XML file's nodes that have an id attribute assigned.

 

ignoreWhite:Boolean

Default setting is false.

 

loaded:Boolean

The property that indicates whether the XML document has successfully loaded.

 

status:Number

Automatically sets and returns a numeric value that indicates whether an XML document was successfully parsed into an XML object.

 

xmlDecl:String

A string that specifies information about a document's XML declaration.

Properties inherited from class XMLNode

attributes (XMLNode.attributes property), childNodes (XMLNode.childNodes property), firstChild (XMLNode.firstChild property), lastChild (XMLNode.lastChild property), localName (XMLNode.localName property), namespaceURI (XMLNode.namespaceURI property), nextSibling (XMLNode.nextSibling property), nodeName (XMLNode.nodeName property), nodeType (XMLNode.nodeType property), nodeValue (XMLNode.nodeValue property), parentNode (XMLNode.parentNode property), prefix (XMLNode.prefix property), previousSibling (XMLNode.previousSibling property)


Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)


Event summary

Event

Description

onData = function(src:String) {}

Invoked when XML text has been completely downloaded from the server, or when an error occurs downloading XML text from a server.

onHTTPStatus = function(httpStatus:Number) {}

Invoked when Flash Player receives an HTTP status code from the server.

onLoad = function(success:Boolean) {}

Invoked by Flash Player when an XML document is received from the server.

Constructor summary

Signature

Description

XML(text:String)

Creates a new XML object.

Method summary

Modifiers

Signature

Description

 

addRequestHeader(header:Object, headerValue:String) : Void

Adds or changes HTTP request headers (such as Content-Type or SOAPAction) sent with POST actions.

 

createElement(name:String) : XMLNode

Creates a new XML element with the name specified in the parameter.

 

createTextNode(value:String) : XMLNode

Creates a new XML text node with the specified text.

 

getBytesLoaded() : Number

Returns the number of bytes loaded (streamed) for the XML document.

 

getBytesTotal() : Number

Returns the size, in bytes, of the XML document.

 

load(url:String) : Boolean

Loads an XML document from the specified URL and replaces the contents of the specified XML object with the downloaded XML data.

 

parseXML(value:String) : Void

Parses the XML text specified in the value parameter, and populates the specified XML object with the resulting XML tree.

 

send(url:String, [target:String], [method:String]) : Boolean

Encodes the specified XML object into an XML document and sends it to the specified target URL.

 

sendAndLoad(url:String, resultXML:XML) : Void

Encodes the specified XML object into an XML document, sends it to the specified URL using the POST method, downloads the server's response, and loads it into the resultXMLobject specified in the parameters.

Methods inherited from class XMLNode

appendChild (XMLNode.appendChild method), cloneNode (XMLNode.cloneNode method), getNamespaceForPrefix (XMLNode.getNamespaceForPrefix method), getPrefixForNamespace (XMLNode.getPrefixForNamespace method), hasChildNodes (XMLNode.hasChildNodes method), insertBefore (XMLNode.insertBefore method), removeNode (XMLNode.removeNode method), toString (XMLNode.toString method)


Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)



Flash CS3


 

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

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