Google Apps Script
Feedback on this document

Class XmlElement

Deprecated. For new scripts, please prefer the XmlService instead.

An XML element. This class aids in navigating an XML hierarchy. Elements have a name, a set of attributes, and a sequence of children.

Methods

MethodReturn typeBrief description
getAttribute(expandedName)XmlAttributeGets the child attribute with the given name.
getAttribute(namespaceName, localName)XmlAttributeGets the child attribute with the given name.
getAttributes()XmlAttribute[]Gets all child attributes of this element.
getElement()XmlElementGets the first child element of this element.
getElement(expandedName)XmlElementGets the first child element with the given name.
getElement(namespaceName, localName)XmlElementGets the first child element with the given name.
getElements()XmlElement[]Gets all child elements of this element.
getElements(expandedName)XmlElement[]Gets all child elements of this element.
getElements(namespaceName, localName)XmlElement[]Gets all child elements with the given name.
getName()XmlNameGets the name of this XmlElement.
toXmlString()StringReturns this node as an XML string.

Detailed documentation

getAttribute(expandedName)

Gets the child attribute with the given name.

Parameters

NameTypeDescription
expandedNameStringthe expanded name to look for

Return

XmlAttribute — the attribute with the provided expanded name (or null if there is no such child)


getAttribute(namespaceName, localName)

Gets the child attribute with the given name.

Parameters

NameTypeDescription
namespaceNameStringthe name of the namespace to look for
localNameStringthe local name to look for

Return

XmlAttribute — the attribute with the provided namespace name and local name (or null if there is no such child)


getAttributes()

Gets all child attributes of this element.

Return

XmlAttribute[] — the attributes that this element has


getElement()

Gets the first child element of this element.

Return

XmlElement — the first child element of this element (or null if there is no such element)


getElement(expandedName)

Gets the first child element with the given name.

Parameters

NameTypeDescription
expandedNameStringthe expanded name to look for

Return

XmlElement — this first child element of this element with the provided expanded name, or null if there is no such element


getElement(namespaceName, localName)

Gets the first child element with the given name.

Parameters

NameTypeDescription
namespaceNameStringthe name of the namespace to look for
localNameStringthe local name to look for

Return

XmlElement — this first child element of this element with the provided namespace name and local name, or null if there is no such element


getElements()

Gets all child elements of this element.

Return

XmlElement[] — all the child elements of this element in document order


getElements(expandedName)

Gets all child elements of this element.

Parameters

NameTypeDescription
expandedNameStringthe expanded name to look for

Return

XmlElement[] — all the child elements of this element, with the provided expanded name, in document order


getElements(namespaceName, localName)

Gets all child elements with the given name.

Parameters

NameTypeDescription
namespaceNameStringthe name of the namespace to look for
localNameStringthe local name to look for

Return

XmlElement[] — all the child elements of this element, with the provided namespace name and local name, in document order


getName()

Gets the name of this XmlElement.

Return

XmlName — the name of this element


toXmlString()

Returns this node as an XML string. For an XmlElement or XmlDocument, this will be the fully converted node in XML string form. For minor nodes like XmlAttribute, this will be in simplified XML fragments like foo="bar".

Return

String — this node in string form

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.