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
- fromString(xmlString)
- fromURL(url)
Class Parser
Instance Methods
- parseFromString(xmlString)
Document (xmlDocument)
Instantiate with the static functions Document.fromString()
and fromURL()
.
Parameters
xmlDocument |
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 |
Parser ()
XMLParser
Parser.prototype.parseFromString (xmlString)
Parameters
xmlString |