XML

Description

Wraps XML into an object.

Static Properties

ignoreComments readonly Controls whether XML comments should be parsed (false) or ignored (true).
ignoreProcessingInstructions readonly Controls whether XML preprocessing instructions should be parsed (false) or ignored (true).
ignoreWhitespace readonly Controls whether whitespace should be parsed (false) or ignored (true).
prettyIndent readonly The number of spaces used to indent pretty-printed XML.
prettyPrinting readonly When true, XML is pretty-printed when converting to a string.

Constructors

XML readonly Parses an XML string. Throws an error if the XML is incorrect.

Methods

addNamespace readonly Adds a namespace declaration to the node. Returns the XML object itself.
appendChild readonly Appends the given XML to this XML as a child. Returns the XML object itself.
attribute readonly Returns a list containing all attribute elements matching the given name.
attributes readonly Returns a list containing all attribute elements.
child readonly Returns a list containing all children of this XML matching the given element name.
childIndex readonly Returns a number representing the ordinal position of this XML object within the context of its parent.
children readonly Returns an XML object containing all the properties of this XML object in order.
comments readonly Returns an XML object containing the properties of this XML object that represent XML comments.
contains readonly Checks if this XML object contains the given XML object.
copy readonly Creates a copy of this XML object.
descendants readonly Returns all the XML-valued descendants of this XML object with the given name.
elements readonly Returns a list of XML children that are elements with a given name, or all children that are XML elements.
hasComplexContent readonly Reports whether this XML object contains complex content.
hasSimpleContent readonly Reports whether this XML object contains simple content.
inScopeNamespaces readonly Returns an array of Namespace objects mirroring the current list of valid namespaces at this element.
insertChildAfter readonly Inserts the given child2 after the given child1 in this XML object and returns this XML object.
insertChildBefore readonly Inserts the given child2 before the given child1 in this XML object and returns this XML object.
length readonly Returns the number of elements contained in an XML list. If this XML object is not a list, returns 1.
localName readonly Returns the local name of this XML object.
name readonly Returns a QName object containing the URI and the local name of the element.
namespace readonly Returns a Namespace object containing the namespace URI of the current element.
namespaceDeclarations readonly Returns an array containing all namespace declarations of this XML object.
nodeKind readonly Returns the type of this XML object as one of the strings “element”, “attribute”, “comment”, “processing-instruction”, or “text”.
normalize readonly Puts all text nodes in this and all descendant XML objects into a normal form by merging adjacent text nodes and eliminating empty text nodes. Returns this XML object.
parent readonly Returns the parent object of this XML object.
prependChild readonly Inserts a given child into this object before its existing XML properties, and returns this XML object.
processingInstructions readonly Returns a list of preprocessing instructions.
removeNamespace readonly Removes the given namespace from this XML, and returns this XML.
replace readonly Replaces the value of specified XML properties of this XML object returns this XML object.
setChildren readonly Replaces all of the XML-valued properties in this object with a new value, and returns this XML object.
setLocalName readonly Replaces the local name of this XML object with a string constructed from the given name
setName readonly Replaces the name of this XML object with the given QName object.
setNamespace readonly Sets the namespace for this XML element.
text readonly Returns an XML list containing all XML properties of this XML object that represent XML text nodes.
toString readonly Returns the string representation of this object.
toXMLString readonly Returns an XML-encoded string representation of this XML object.
xpath readonly Evaluates the given XPath expression in accordance with the W3C XPath recommendation, using this XML object as the context node.

Static Methods

defaultSettings readonly Returns an object containing the default parsing and print settings for XML.
setSettings readonly Sets the parsing and print setting for XML using an object returned by the settings() method.
settings readonly Returns an object containing the current parsing and print settings for XML.