XMLList

Moduleejs
Namespaceintrinsic
Definitionfinal class XMLList
SpecifiedEcma-357.
InheritanceXMLList inherit Object

The XMLList class, and the entire XML API, is based on ECMA-357, ECMAScript for XML (E4X).

An XMLList object stores a list of XML objects. If the list has only one element, it functions similar to an XML object.


Properties

QualifiersPropertyTypeDescription
No properties defined

XMLList Methods

QualifiersMethod
public appendChild(child: XML): XML
 Append a child to this XML object.
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 child(name: String): XMLList
 Get an XMLList containing the list of children (properties) in this XML object with the given name.
public childIndex(): Number
 Get the position of this object within the context of its parent.
public children(): XMLList
 Get an XMLList containing the children (properties) of this object in order.
public comments(): XMLList
 Get an XMLList containing the properties of this object that are comments.
public contains(obj: Object): Boolean
 Compare an XML object to another one or an XMLList with only one XML object in it.
public copy(): XML
 Deep copy an XML object.
public defaultSettings(): Object
 Get the defaults settings for an XML object.
public descendants(name: String): Object
 Get all the descendants (that have the same name) of this XML object.
public elements(name: String): XMLList
 Get all the children of this XML node that are elements having the given name.
iterator override get(deep: Boolean): Iterator
 Get an iterator for this node to be used by "for (v in node)".
iterator override getValues(deep: Boolean): Iterator
 Get an iterator for this node to be used by "for each (v in node)".
public hasComplexContent(): Boolean
 Determine whether this XML object has complex content.
public hasSimpleContent(): Boolean
 Determine whether this XML object has simple content.
public insertChildAfter(marker: Object, child: Object): XML
 Insert a child object into an XML object immediately after a specified marker object.
public insertChildBefore(marker: Object, child: Object): XML
 Insert a child object into an XML object immediately before a specified marker object.
public override length(): Number
 Return the length of an XML object; the length is defined as 1.
public localName(): String
 Get the local name portion of the complete name of this XML object.
public name(): String
 Get the qualified name of this XML object.
public nodeKind(): String
 Get the kind of node this XML object is.
public normalize(): XML
 Merge adjacent text nodes into one text node and eliminate empty text nodes.
public parent(): XML
 Get the parent of this XML object.
public prependChild(child: Object): XML
 Insert a child object into an XML object immediately before all existing properties.
public processingInstructions(name: String): XMLList
 Get all the children of this XML node that are processing instructions having the given name.
public replace(property: Object, value: Object): Void
 Change the value of a property.
public setChildren(properties: Object): XML
 Replace all the current properties of this XML object with a new set.
public setLocalName(name: String): Void
 Set the local name portion of the complete name of this XML object.
public setName(name: String): Void
 Set the qualified name of this XML object.
public setSettings(settings: Object): Void
 Configure the settings for this XML object.
public settings(): Object
 Get the settings for this XML object.
public text(name: String): XMLList
 Get all the properties of this XML node that are text nodes having the given name.
public override toJSON(): String
 Convert to a JSON encoding.
public override toString(): String
 Provides a string representation of the XML object.
public toXMLString(): String
 Provides an XML-encoded version of the XML object that includes the tags.
XMLList()
 XML Constructor.

Method Detail

public appendChild(child: XML): XML

Append a child to this XML object.

Parameters
child: XML The child to add.
Returns
This object with the added child.

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 child(name: String): XMLList

Get an XMLList containing the list of children (properties) in this XML object with the given name.

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

public childIndex(): Number

Get the position of this object within the context of its parent.

Returns
A number with the zero-based position.

public children(): XMLList

Get an XMLList containing the children (properties) of this object in order.

Returns
An XMLList with all the properties.

public comments(): XMLList

Get an XMLList containing the properties of this object that are comments.

Returns
An XMLList with all the comment properties.

public contains(obj: Object): Boolean

Compare an XML object to another one or an XMLList with only one XML object in it.

Description
If the comparison operator is true, then one object is said to contain the other.
Returns
True if this object contains the argument.

public copy(): XML

Deep copy an XML object.

Description
The new object has its parent set to null.
Returns
Then new XML object.

public defaultSettings(): Object

Get the defaults settings for an XML object.

Description
The settings include boolean values for: ignoring comments, ignoring processing instruction, ignoring white space and pretty printing and indenting. See ECMA-357 for details.
Returns
Get the settings for this XML object.

public descendants(name: String): Object

Get all the descendants (that have the same name) of this XML object.

Description
The optional argument defaults to getting all descendants.
Parameters
name: String The (optional) name to search on.
Returns
The list of descendants.

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.
Returns
The list of elements.

override iterator get(deep: Boolean): Iterator

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

Parameters
deep: Boolean Follow the prototype chain. Only implemented in ECMA compliance mode.. [default: false]
Returns
An iterator object.

override iterator getValues(deep: Boolean): Iterator

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

Parameters
deep: Boolean Follow the prototype chain. Only implemented in ECMA compliance mode.. [default: false]
Returns
An iterator object.

public hasComplexContent(): Boolean

Determine whether this XML object has complex content.

Description
If the object has child elements it is considered complex.
Returns
True if this object has complex content.

public hasSimpleContent(): Boolean

Determine whether this XML object has simple content.

Description
If the object is a text node, an attribute node or an XML element that has no children it is considered simple.
Returns
True if this object has simple content.

public insertChildAfter(marker: Object, child: Object): XML

Insert a child object into an XML object immediately after a specified marker object.

Description
If the marker object is null then the new object is inserted at the beginning. If the marker object is not found then the insertion is not made. TODO - if marker is null, should it insert at the beginning or end?.
Parameters
marker: Object Insert the new element after this one.
child: Object Child element to be inserted.
Returns
This XML object - modified or not.

public insertChildBefore(marker: Object, child: Object): XML

Insert a child object into an XML object immediately before a specified marker object.

Description
If the marker object is null then the new object is inserted at the end. If the marker object is not found then the insertion is not made. TODO - if marker is null, should it insert at the beginning?.
Parameters
marker: Object Insert the new element before this one.
child: Object Child element to be inserted.
Returns
This XML object - modified or not.

override public length(): Number

Return the length of an XML object; the length is defined as 1.

Returns
1.

public localName(): String

Get the local name portion of the complete name of this XML object.

Returns
The local name.

public name(): String

Get the qualified name of this XML object.

Returns
The qualified name.

public nodeKind(): String

Get the kind of node this XML object is.

Returns
The node kind.

public normalize(): XML

Merge adjacent text nodes into one text node and eliminate empty text nodes.

Returns
This XML object.

public parent(): XML

Get the parent of this XML object.

Returns
The parent.

public prependChild(child: Object): XML

Insert a child object into an XML object immediately before all existing properties.

Parameters
child: Object Child element to be inserted.
Returns
This XML object - modified or not.

public processingInstructions(name: String): XMLList

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

Description
The optional argument defaults to getting all processing instruction nodes.
Parameters
name: String The (optional) name to search on.
Returns
The list of processing instruction nodes.

public replace(property: Object, value: Object): Void

Change the value of a property.

Description
If the property is not found, nothing happens.
Parameters
property: Object The property to change.
value: Object The new value.
Returns
True if the property will be enumerated.

public setChildren(properties: Object): XML

Replace all the current properties of this XML object with a new set.

Description
The argument can be another XML object or an XMLList.
Parameters
properties: Object The new property or properties.
Returns
This XML object.

public setLocalName(name: String): Void

Set the local name portion of the complete name of this XML object.

Parameters

public setName(name: String): Void

Set the qualified name of this XML object.

Parameters

public setSettings(settings: Object): Void

Configure the settings for this XML object.

Parameters
settings: Object A "settings" object previously returned from a call to the "settings" method.

public settings(): Object

Get the settings for this XML object.

Description
The settings include boolean values for: ignoring comments, ignoring processing instruction, ignoring white space and pretty printing and indenting. See ECMA-357 for details.
Returns
Get the settings for this XML object.

public text(name: String): XMLList

Get all the properties of this XML node that are text nodes having the given name.

Description
The optional argument defaults to getting all text nodes.
Parameters
name: String The (optional) name to search on.
Returns
The list of text nodes.

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 toXMLString(): String

Provides an XML-encoded version of the XML object that includes the tags.

Returns
A string with the encoding.

XMLList()

XML Constructor.

Description
Create an empty XML object.
Returns
An XML node object.