XML
Module | ejs |
Definition | final class XML |
Inheritance | XML ![]() |
Specified | ejscript-1.1 |
The XML class provides a simple ability to load, parse and save XML documents.
Properties
Qualifiers | Property | Type | Description |
---|---|---|---|
No properties defined |
XML Methods
Qualifiers | Method |
---|---|
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
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).
Get an XMLList containing all of the attributes of this object.
- Returns
- An XMLList with all the attributes (zero or more).
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.
Get an iterator for this node to be used by "for (v in node)".
- Returns
- An iterator object.
Get an iterator for this node to be used by "for each (v in node)".
- Returns
- An iterator object.
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.
Load an XML document.
- Parameters
filename: String Name of the file containing the XML document to load.
Get the qualified name of this XML object.
- Returns
- The qualified name.
Get the parent of this XML object.
- Returns
- The parent.
Save the XML object to a file.
- Parameters
filename: String Name of the file to save the XML document to.
Convert to a JSON encoding.
- Returns
- A JSON string.
Provides a string representation of the XML object.
- Returns
- A string with the encoding.
XML Constructor.
- Description
- Create an empty XML object.
- Parameters
value: Object An optional XML or XMLList object to clone. [default: null]