XML

Moduleejs
Definitionfinal class XML
InheritanceXML inherit Object
Specifiedejscript-1.1

The XML class provides a simple ability to load, parse and save XML documents.


Properties

QualifiersPropertyTypeDescription
No properties defined

XML Methods

QualifiersMethod
public attribute(name: String): XMLList
 Get an XMLList containing all of the attributes of this object with the given name.
public attributes(): XMLList
 Get an XMLList containing all of the attributes of this object.
public elements(name: String = *): XMLList
 Get all the children of this XML node that are elements having the given name.
iterator override get(): Iterator
 Get an iterator for this node to be used by "for (v in node)".
iterator override getValues(): Iterator
 Get an iterator for this node to be used by "for each (v in node)".
public override length(): Number
 Return the length of an XML object in elements NOTE: This is a method and must be invoked with ().
public load(filename: String): Void
 Load an XML document.
public name(): String
 Get the qualified name of this XML object.
public parent(): XML
 Get the parent of this XML object.
public save(filename: String): Void
 Save the XML object to a file.
public override toJSON(): String
 Convert to a JSON encoding.
public override toString(): String
 Provides a string representation of the XML object.
XML(value: Object = null)
 XML Constructor.

Method Detail

public attribute(name: String): XMLList

Get an XMLList containing all of the attributes of this object with the given name.

Parameters
name: String The name to search on.
Returns
An XMLList with all the attributes (zero or more).

public attributes(): XMLList

Get an XMLList containing all of the attributes of this object.

Returns
An XMLList with all the attributes (zero or more).

public elements(name: String = *): XMLList

Get all the children of this XML node that are elements having the given name.

Description
The optional argument defaults to getting all elements.
Parameters
name: String The (optional) name to search on. [default: *]
Returns
The list of elements.

override iterator get(): Iterator

Get an iterator for this node to be used by "for (v in node)".

Returns
An iterator object.

override iterator getValues(): Iterator

Get an iterator for this node to be used by "for each (v in node)".

Returns
An iterator object.

override public length(): Number

Return the length of an XML object in elements NOTE: This is a method and must be invoked with ().

Returns
A number indicating the number of child elements.

public load(filename: String): Void

Load an XML document.

Parameters
filename: String Name of the file containing the XML document to load.

public name(): String

Get the qualified name of this XML object.

Returns
The qualified name.

public parent(): XML

Get the parent of this XML object.

Returns
The parent.

public save(filename: String): Void

Save the XML object to a file.

Parameters
filename: String Name of the file to save the XML document to.

override public toJSON(): String

Convert to a JSON encoding.

Returns
A JSON string.

override public toString(): String

Provides a string representation of the XML object.

Returns
A string with the encoding.

public XML(value: Object = null)

XML Constructor.

Description
Create an empty XML object.
Parameters
value: Object An optional XML or XMLList object to clone. [default: null]