Core JavaScriptExtendScript only
Object

XML

Wraps XML into an object.

Properties

NameType AccessDescription
static Boolean = true read/write Controls whether XML comments should be parsed (false) or ignored (true).
static Boolean = true read/write Controls whether XML preprocessing instructions should be parsed (false) or ignored (true).
static Boolean = true read/write Controls whether whitespace should be parsed (false) or ignored (true).
static Number = 2 read/write The number of spaces used to indent pretty-printed XML.
static Boolean = true read/write When true, XML is pretty-printed when converting to a string.

Methods

XML

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

text String The text to parse.
XML

Adds a namespace declaration to the node. Returns the XML object itself.

namespace Namespace The namespace to add.
XML

Appends the given XML to this XML as a child. Returns the XML object itself.

child XML The child XML to add.
XML

Returns a list containing all attribute elements matching the given name.

name String The attribute name to look for.
XML

Returns a list containing all attribute elements.

XML

Returns a list containing all children of this XML matching the given element name.

name String The name or the index of the child element.
Number

Returns a number representing the ordinal position of this XML object within the context of its parent.

XML

Returns an XML object containing all the properties of this XML object in order.

XML

Returns an XML object containing the properties of this XML object that represent XML comments.

Boolean

Checks if this XML object contains the given XML object.

xml XML The XML to search for.
XML

Creates a copy of this XML object.

Object

Returns an object containing the default parsing and print settings for XML.

XML

Returns all the XML-valued descendants of this XML object with the given name.

name? String The name of the descendant to find.
XML

Returns a list of XML children that are elements with a given name, or all children that are XML elements.

name? String The element name. If not supplied, gets all children that are XML elements.
Boolean

Reports whether this XML object contains complex content.

Boolean

Reports whether this XML object contains simple content.

Array

Returns an array of Namespace objects mirroring the current list of valid namespaces at this element.

void

Inserts the given child2 after the given child1 in this XML object and returns this XML object.

child1 XML The child to insert the other child after.
child2 XML The XML to insert.
void

Inserts the given child2 before the given child1 in this XML object and returns this XML object.

child1 XML The child to search for.
child2 XML The XML to insert.
Number

Returns the number of elements contained in an XML list. If this XML object is not a list, returns 1.

String

Returns the local name of this XML object.

QName

Returns a QName object containing the URI and the local name of the element.

Namespace

Returns a Namespace object containing the namespace URI of the current element.

Array

Returns an array containing all namespace declarations of this XML object.

String

Returns the type of this XML object as one of the strings "element", "attribute", "comment", "processing-instruction", or "text".

XML

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.

XML

Returns the parent object of this XML object.

XML

Inserts a given child into this object before its existing XML properties, and returns this XML object.

child XML The XML to insert.
XML

Returns a list of preprocessing instructions.

name? String The name of the preprocessing instruction to return.
XML

Removes the given namespace from this XML, and returns this XML.

namespace Namespace The namespace to remove.
XML

Replaces the value of specified XML properties of this XML object returns this XML object.

name String The property name.
value XML The XML with which to replace the value of the matching property.
XML

Replaces all of the XML-valued properties in this object with a new value, and returns this XML object.

value XML The new value, which can be a single XML object or an XML list.
void

Replaces the local name of this XML object with a string constructed from the given name

name String The name to set.
void

Replaces the name of this XML object with the given QName object.

name QName The fully qualified name.
void

Sets the namespace for this XML element.

namespace Namespace The namespace to set.
void

Sets the parsing and print setting for XML using an object returned by the settings() method.

obj Object The object containing the settings to set.
Object

Returns an object containing the current parsing and print settings for XML.

XML

Returns an XML list containing all XML properties of this XML object that represent XML text nodes.

String

Returns the string representation of this object.

String

Returns an XML-encoded string representation of this XML object.

XML

Evaluates the given XPath expression in accordance with the W3C XPath recommendation, using this XML object as the context node.

expr String The XPath expression to use.

Parameter of 7

Method parameters that accept a XML.

Return 21

Methods that return a XML.