XML
Constructors
Constructor
new XML(
message?):XML
Parameters
stringReturns
XMLMethods
addNamespace
addNamespace(
namespace):void
Adds the namespace to the in-scope namespaces of the element
Parameters
stringReturns
voidappendChild
appendChild(
child):void
Adds the given child as a new child of the element, after all other children
Parameters
XMLReturns
voidattribute
attribute(
attributeName):string
Returns the attribute with the requested name
Parameters
stringReturns
stringattributes
attributes():
string[]
Returns all attributes of this element
Returns
string[]child
child(
propertyName):XML[]
Returns the child element with the given propertyName, or if propertyName is an integer, returns the child in that position
Parameters
string | numberReturns
XML[]childIndex
childIndex():
number
Returns the index of this child among its siblings
Returns
numberchildren
children():
XML[]
Returns all children of this object
Returns
XML[]comments
comments():
string
Returns all the comments that are children of this XML object
Returns
stringcontains
contains(
value):boolean
Compares this element with the value, primarily provided to enable an XML element and an XML list to be used interchangeably
Parameters
stringReturns
booleancopy
copy():
XML
Returns a deep copy of this element (children, grandchildren, ...)
Returns
XMLdescendants
descendants(
name?):XML[]
Returns the descendant elements. If a name is provided, only elements with that name are returned.
Parameters
stringReturns
XML[]elements
elements(
name?):XML[]
Returns the child elements. If a name is provided, only elements with that name are returned
Parameters
stringReturns
XML[]hasComplexContent
hasComplexContent():
boolean
Returns true for elements with child elements, otherwise false
Returns
booleanhasSimpleContent
hasSimpleContent():
boolean
Returns true for attributes, text nodes, or elements without child elements, otherwise false
Returns
booleaninScopeNamespaces
inScopeNamespaces():
string[]
Returns an array of namespaces in scope for this object
Returns
string[]insertChildAfter
insertChildAfter(
child1,child2):void
Inserts child2 immediately after child1 in the XML object's children list
Parameters
XMLXMLReturns
voidinsertChildBefore
insertChildBefore(
child1,child2):void
Inserts child2 immediately prior to child1 in the XML object's children list
Parameters
XMLXMLReturns
voidlength
length():
number
Returns 1 for XML objects (allowing an XML object to be treated like an XML List with a single item)
Returns
numberlocalName
localName():
string
Returns the local name of this object
Returns
stringname
name():
string
Returns the qualified name of this object
Returns
stringnamespace
namespace(
prefix?):string
Returns the namespace associated with this object, or if a prefix is specified, an in-scope namespace with that prefix
Parameters
stringReturns
stringnamespaceDeclarations
namespaceDeclarations():
string[]
An array of namespace objects representing the namespace declarations associated with this object
Returns
string[]nodeKind
nodeKind():
string
A string representing the kind of object this is (e.g. "element")
Returns
stringnormalize
normalize():
void
Merge adjacent text nodes and eliminate empty ones
Returns
voidparent
parent():
XML
The parent of this object
Returns
XMLprependChild
prependChild(
value):void
Add a new child to an element, prior to all other children
Parameters
XMLReturns
voidprocessingInstructions
processingInstructions(
name?):string[]
A list of all processing instructions that are children of this element. If a name is provided, only processing instructions matching this name will be returned.
Parameters
stringReturns
string[]removeNamespace
removeNamespace(
value):void
Removes a namespace from the in-scope namespaces of the element
Parameters
stringReturns
voidreplace
replace(
propertyName,value):any
Replace a child with a new value
Parameters
stringXMLReturns
anysetChildren
setChildren(
value):void
Replace all children of this object with the given ones
Parameters
XML[]Returns
voidsetLocalName
setLocalName(
name):void
Sets the local name of this XML object to the requested value
Parameters
stringReturns
voidsetName
setName(
name):void
Sets the name of this XML object to the requested value
Parameters
stringReturns
voidsetNamespace
setNamespace(
ns):void
Sets the namespace of this XML object to the requested value
Parameters
stringReturns
voidtext
text():
string
Concatenation of all text node children
Returns
stringtoString
toString():
string
For elements without element children, returns the values of the text node children. For elements with children, returns same as toXMLString. For other kinds of objects, the value of the object.
Returns
stringtoXMLString
toXMLString():
string
Serializes this XML object as parse-able XML
Returns
stringvalueOf
valueOf():
XML
Returns this XML object
Returns
XMLIndexable
[key: string]: any