Module gamejs/utils/xml

Provides facilities for parsing a xml String.

You will typically get a gamejs.xml.Document instance by loading the data with one of the two static Document.fromString(string) or Document.fromUrl(url). Querying for elements(name) or children() will return a new gamejs.xml.Document matching your result (or null).

Use attributes(name) and value() to get the data stored in the XML Document.

Class Document

Instance Methods

Static Methods

Class Parser

Instance Methods


Document (xmlDocument)

Instantiate with the static functions Document.fromString() and fromURL().

Parameters

xmlDocument

Document.fromString (xmlString)

Parameters

xmlString

Returns

gamejs.xml.Document

Document.fromURL (url)

Parameters

url

Returns

gamejs.xml.Document

Document.prototype.attribute (name)

Returns the attribute value of this document.

Parameters

name

Returns

String

Document.prototype.children ()

Returns all children of this xml document

Returns

Array of gamejs.xml.Document

Document.prototype.element (name)

Returns the first element in the current document whose tag-name matches the given 'name'.

Parameters

name

Returns

gamejs.xml.Document

Document.prototype.elements (name)

Returns all elements in the current document whose tag-name matches the given 'name'.

Parameters

name

Returns

an Array of gamejs.xml.Document

Document.prototype.value ()

Returns the nodevalue of the current xml document

Returns

String

Parser ()

XMLParser


Parser.prototype.parseFromString (xmlString)

Parameters

xmlString