Summary of the Properties, Methods, and Events of the XML Class

Summary of the Properties, Methods , and Events of the XML Class

This section provides a summary of the properties and methods of the XML class. Many of the properties and methods also apply to the XMLNode class, and Ive noted this within the relevant tables. Table 4-3 shows a summary of the methods of the XML class.

Table 4-3: Summary of methods of the XML class

Method

Explanation

Applies to XMLNode

addRequestHeader

Adds a custom HTTP header or changes an existing HTTP header

 

appendChild

Adds a child node at the end of the current collection of child nodes

Yes

cloneNode

Copies an existing node, optionally with all children

Yes

createElement

Creates a new XML element without positioning it in the document tree

 

createTextNode

Creates a new child text node

 

getBytesLoaded

Returns the number of bytes loaded from an external XML document

 

getBytesTotal

Returns the total number of bytes in an external XML document

 

getNamespaceForPrefix

Returns the namespace URI associated with the prefix of the node

Yes (XMLNode only)

getPrefixForNamespace

Returns the prefix associated with the namespace for the node

Yes (XMLNode only)

hasChildNodes

Returns a Boolean value indicating whether or not an element has child nodes

Yes

insertBefore

Inserts a child node before a specified child node

Yes

load

Loads an external XML document

 

parseXML

Parses XML content into a document tree

 

removeNode

Removes the specified node

Yes

send

Sends XML content to an external server-side page

 

sendAndLoad

Sends XML content to an external server-side page and receives an XML reply in another XML object

 

toString

Converts XML content to a string representation

Yes

Table 4-4 shows a summary of the properties of the XML class.

Table 4-4: Summary of properties of the XML class

Property

Explanation

Read-only

Applies to XMLNode

contentType

Sets the MIME type of the content

   

docTypeDecl

Sets and returns the DOCTYPE declaration

   

firstChild

Returns the first child in the collection of child nodes

Yes

Yes

ignoreWhite

Determines whether white space is preserved when an XML document is parsed

   

lastChild

Returns the last child in the collection of child nodes

Yes

Yes

loaded

Returns a Boolean value indicating whether an external XML document has been loaded

Yes

 

localName

R eturns the full name of the XMLNode object i.e. the name without the prefix

Yes

Yes (XMLNode only)

namespaceURL

Returns the URL of the namespace to which the XML nodes prefix resolves

Yes

Yes (XMLNode only)

nextSibling

Finds the next sibling in the parent nodes collection of child nodes

Yes

Yes

nodeName

Finds the name of an element node

 

Yes

nodeType

Finds the node type

Yes

Yes

nodeValue

Find the text within a text node

 

Yes

parentNode

Finds the parent node of the current child

Yes

Yes

prefix

Returns the prefix of the node name

Yes

Yes (XMLNode only)

previousSibling

Finds the previous sibling in the parent nodes collection of child nodes

Yes

Yes

status

Returns a number providing information about the parsing of an XML document

   

xmlDecl

Sets and returns the XML declaration

   

Table 4-5 shows a summary of the events of the XML class.

Table 4-5: Summary of events of the XML class

Event handler

Explanation

onData

Triggered when external XML data is loaded, before it is parsed by Flash. Also triggered when an error occurs in loading XML data.

onHTTPStatus

Invoked when the load or sendAndLoad operation has ended. Returns the status code from the server e.g. 404 for page not found.

onLoad

Triggered after external XML data is loaded and parsed by Flash.

Both the XML and XMLNode classes include the collections listed in Table 4-6.

Table 4-6: Collections within the XML and XMLNode classes

Collection

Explanation

Read-only

attributes

Associative array of all attributes within a node

 

childNodes

Array of child nodes within the current parent node

Yes



Foundation XML for Flash
Foundation XML for Flash
ISBN: 1590595432
EAN: 2147483647
Year: 2003
Pages: 93
Authors: Sas Jacobs

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net