Child pages
  • XML

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Hidden
DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY, UNLESS YOU KNOW WHAT YOU'RE DOING.
		THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO EXTRACT CHANGES FROM THE PAGE AND MERGE THEM BACK INTO SERVOY SOURCE
Creating XML objects

from a string

Code Block
var myXml = new XML('<test level="1"><test2 level="2">A value</test2></test>');

using XML object notation

Code Block
var myXml =
<test level="1">
  <test2 level="2">A value</test2>
</test>;

using JavaScript variables

Code Block
var myValue = 'hello, some value!';
var myXml =
<test level="1">
  <test2 level="2">{myValue}</test2>
</test>;
Accessing the XML

General

Code Block
var myXml = new XML('<test level="1"><test2 level="2">A value</test2></test>');
application.output(myXml.test2); //outputs 'A value'

A specific index on subnodes

Code Block
var myXml = new XML('<test level="1"><test2 level="2">A value</test2><test2 level=2>Another value</test2></test>');
application.output(myXml.test2[1]); //outputs 'Another value'

XML in Action!

Video
http://www.servoy.com/docs/servoy_4/tutorials/qv_javascript_XML/JS_XML.swf
http://www.servoy.com/docs/servoy_4/tutorials/qv_javascript_XML/JS_XML.swf

HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Property Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#ignoreComments
If set to true, then comments in the XML are ignored when constructing new XML objects.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#ignoreProcessingInstructions
If set to true, then processing instructions are ignored when constructing new XML objects.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#ignoreWhitespace
If set to true, then whitespace in the XML is ignored when constructing new XML objects.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#prettyIndent
The amount of positions used when indenting child nodes are relative to their parent
if prettyPrinting is enabled.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#prettyPrinting
If set to true, then toString() and toXMLString() methods will normalize the output
to achieve a uniform appearance.

HTML Table
classservoy sSummary
Colgroup Tag
Column
padding0px
width80px

Column

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan2
Method Summary
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#addNamespace(namespaceToAdd)
Takes one argument which can be a string with a namespace URI or a Namespace object and adds the
argument to the in scope namespaces of this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#appendChild(childToAppend)
Appends a new child at the end of this XML object's properties, the changed XML object is then returned.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#attribute(attributeName)
Takes a single argument with the attribute name and returns an XMLList with attributes
matching the argument.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#attributes()
Returns an XMLList with the attributes of this XML object which are in no namespace.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#child(propertyName)
Returns an XMLList with children matching the property name.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#childIndex()
If the XML object has no parent then the special number NaN is returned, otherwise the ordinal
position the object has in the context of its parent is returned.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#children()
Returns an XMLList with the child nodes of this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#comments()
Returns an XMLList with the comment nodes which are children of this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#contains(value)
Calling xmlObject.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#copy()
Returns a deep copy of the XML object it is called on where the internal parent property is set to null
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#defaultSettings()
Returns an object containing the default XML settings.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#descendants([name])
Returns an XMLList with the descendants matching the passed name argument or with all descendants
if no argument is passed.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#elements([name])
Takes one optional argument, the name of elements you are looking for, and returns an XMLList with
all matching child elements.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasComplexContent()
Returns false for XML objects of node kind 'text', 'attribute', 'comment', and 'processing-instruction'.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasOwnProperty(propertyName)
Returns true if the XML object the method is called on has a property of that name.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#hasSimpleContent()
Returns true for XML objects of node kind text or attribute.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#inScopeNamespaces()
Returns an array of Namespace objects representing the namespace that are in scope for this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#insertChildAfter(childToInserAfter, childToInsert)
Takes two arguments, an existing child to insert after and the new child to be inserted.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#insertChildBefore(childToInsertBefore, childToInsert)
Takes two arguments, an existing child to insert before and the new child to be inserted.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Number
Table Cell (td)
#length()
This always returns 1.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#localName()
returns the local name part if the XML object has a name.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
QName
Table Cell (td)
#name()
Returns the qualified name (a QName object) of the XML object it is called
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Namespace
Table Cell (td)
#namespace([prefix])
If no argument is passed to the method then it returns the namespace associated with the qualified
name of this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Array
Table Cell (td)
#namespaceDeclarations()
Returns an array with the namespace declarations associated with the XML object it is called on.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#nodeKind()
Returns a string denoting the kind of node this XML object represents.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#normalize()
Returns this XML object after normalizing all text content.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#parent()
Returns the parent XML object of this XML object or null if there is no parent.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#prependChild(childToPrepend)
Iinserts the given value as the first child of the XML object and returns the XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#processingInstructions([name])
If no argument is passed in then the method returns an XMLList with all the children of the XML
object which are processing instructions.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Boolean
Table Cell (td)
#propertyIsEnumerable(propertyName)
Returns true if the property name is '0' and false otherwise.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#removeNamespace(namespace)
Removes the namespace from the in scope namespaces of this XML object if the namespace
is not used for the qualified name of the object or its attributes.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#replace(propertyName, replacementValue)
Takes two arguments, the property name of the property / properties to be replaced, and the
value to replace the properties.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#setChildren(value)
Replaces all children of the XML object with this value.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setLocalName(name)
Changes the local name of this XML object to the name passed in.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setName(name)
Replaces the name of this XML object with the name passed in.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setNamespace(namespace)
Changes the namespace associated with the name of this XML object to the new namespace.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
void
Table Cell (td)
#setSettings([settings])
Allows the global XML settings to be adjusted or restored to their default values.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
Object
Table Cell (td)
#settings()
Returns an object containing the global XML settings.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XMLList
Table Cell (td)
#text()
Returns an XMLList with all the children of this XML object that represent text nodes.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#toString()
Returns a convenient string value of this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
String
Table Cell (td)
#toXMLString()
Returns a string with the serialized XML markup for this XML object.
Table Body (tbody)
Table Row (tr)
Table Cell (td)
XML
Table Cell (td)
#valueOf()
The method simply returns the XML object it is called on.

HTML Table
idproperty
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Property Details
Table Body (tbody)
idignoreComments
classnode
Table Row (tr)
idname
Table Cell (td)
ignoreComments
Table Row (tr)
iddes
Table Cell (td)
If set to true, then comments in the XML are ignored when constructing new XML objects.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var element = <foo><!-- my comment --><bar/></foo>;
application.output(element.comments().length());
application.output(element.toXMLString());

XML.ignoreComments = false;

element = <foo><!-- my comment --><bar/></foo>;
application.output(element.comments().length());
application.output(element.toXMLString());
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idignoreProcessingInstructions
classnode
Table Row (tr)
idname
Table Cell (td)
ignoreProcessingInstructions
Table Row (tr)
iddes
Table Cell (td)
If set to true, then processing instructions are ignored when constructing new XML objects.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
XML.ignoreProcessingInstructions=false;
var xmlElement = <publishing><?process author="yes"?><author type="leadership">John C. Maxwell</author></publishing>;
application.output(" Element = "+ xmlElement.toXMLString());
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idignoreWhitespace
classnode
Table Row (tr)
idname
Table Cell (td)
ignoreWhitespace
Table Row (tr)
iddes
Table Cell (td)
If set to true, then whitespace in the XML is ignored when constructing new XML objects.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
XML.ignoreWhitespace = false;
 var xmlElement =
 <publishing>
 	<author>John C. Maxwell</author>
 </publishing>;
 application.output(xmlElement.toString());
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idprettyIndent
classnode
Table Row (tr)
idname
Table Cell (td)
prettyIndent
Table Row (tr)
iddes
Table Cell (td)
The amount of positions used when indenting child nodes are relative to their parent
if prettyPrinting is enabled.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var xmlElement = <publishing><author>Tom DeMarco</author><author>Roger S. Pressman</author></publishing>;
application.output(xmlElement.toXMLString());
XML.prettyPrinting = true;
XML.prettyIndent = 4;
xmlElement = <publishing><author>Tom DeMarco</author><author>Roger S. Pressman</author></publishing>;
application.output(xmlElement.toXMLString());
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idprettyPrinting
classnode
Table Row (tr)
idname
Table Cell (td)
prettyPrinting
Table Row (tr)
iddes
Table Cell (td)
If set to true, then toString() and toXMLString() methods will normalize the output
to achieve a uniform appearance.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
var xmlElement = <publishing><author>Tom DeMarco</author><author>Roger S. Pressman</author></publishing>;
application.output(xmlElement.toXMLString());
XML.prettyPrinting = true;
XML.prettyIndent = 4;
xmlElement = <publishing><author>Tom DeMarco</author><author>Roger S. Pressman</author></publishing>;
application.output(xmlElement.toXMLString());
Table Row (tr)
classlastDetailRow
Table Cell (td)


HTML Table
idfunction
classservoy sDetail
Colgroup Tag
Column
padding0px
width100%

Table Row (tr)
styleheight: 30px;
Table Head (th)
colspan1
Method Details
Table Body (tbody)
idaddNamespace
classnode
Table Row (tr)
idname
Table Cell (td)
addNamespace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
addNamespace
Span
stylefloat: left;
idiets
(namespaceToAdd)
Table Row (tr)
iddes
Table Cell (td)
Takes one argument which can be a string with a namespace URI or a Namespace object and adds the
argument to the in scope namespaces of this XML object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} namespaceToAdd
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.addNamespace(namespaceToAdd)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idappendChild
classnode
Table Row (tr)
idname
Table Cell (td)
appendChild
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
appendChild
Span
stylefloat: left;
idiets
(childToAppend)
Table Row (tr)
iddes
Table Cell (td)
Appends a new child at the end of this XML object's properties, the changed XML object is then returned.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{XML} childToAppend
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.appendChild(childToAppend)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idattribute
classnode
Table Row (tr)
idname
Table Cell (td)
attribute
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
attribute
Span
stylefloat: left;
idiets
(attributeName)
Table Row (tr)
iddes
Table Cell (td)
Takes a single argument with the attribute name and returns an XMLList with attributes
matching the argument.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} attributeName
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.attribute(attributeName)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idattributes
classnode
Table Row (tr)
idname
Table Cell (td)
attributes
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
attributes
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with the attributes of this XML object which are in no namespace.
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.attributes()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idchild
classnode
Table Row (tr)
idname
Table Cell (td)
child
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
child
Span
stylefloat: left;
idiets
(propertyName)
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with children matching the property name.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} propertyName
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.child(childPropertyName)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idchildIndex
classnode
Table Row (tr)
idname
Table Cell (td)
childIndex
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
childIndex
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
If the XML object has no parent then the special number NaN is returned, otherwise the ordinal
position the object has in the context of its parent is returned.
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.childIndex()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idchildren
classnode
Table Row (tr)
idname
Table Cell (td)
children
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
children
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with the child nodes of this XML object.
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.children()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcomments
classnode
Table Row (tr)
idname
Table Cell (td)
comments
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
comments
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with the comment nodes which are children of this XML object.
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.comments()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcontains
classnode
Table Row (tr)
idname
Table Cell (td)
contains
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
contains
Span
stylefloat: left;
idiets
(value)
Table Row (tr)
iddes
Table Cell (td)
Calling xmlObject.contains(value) yields the same result as the equality comparison xmlObject == value
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} value
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.contains(value)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idcopy
classnode
Table Row (tr)
idname
Table Cell (td)
copy
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
copy
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a deep copy of the XML object it is called on where the internal parent property is set to null
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.copy()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddefaultSettings
classnode
Table Row (tr)
idname
Table Cell (td)
defaultSettings
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
defaultSettings
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an object containing the default XML settings.
Table Row (tr)
idret
Table Cell (td)
Returns
Object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.defaultSettings()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
iddescendants
classnode
Table Row (tr)
idname
Table Cell (td)
descendants
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
descendants
Span
stylefloat: left;
idiets
([name])
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with the descendants matching the passed name argument or with all descendants
if no argument is passed.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} [name]
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.descendants([name])
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idelements
classnode
Table Row (tr)
idname
Table Cell (td)
elements
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
elements
Span
stylefloat: left;
idiets
([name])
Table Row (tr)
iddes
Table Cell (td)
Takes one optional argument, the name of elements you are looking for, and returns an XMLList with
all matching child elements.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} [name]
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.elements([name])
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasComplexContent
classnode
Table Row (tr)
idname
Table Cell (td)
hasComplexContent
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasComplexContent
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns false for XML objects of node kind 'text', 'attribute', 'comment', and 'processing-instruction'.
For objects of kind 'element' it checks whether the element has at least one child element.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.hasComplexContent()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasOwnProperty
classnode
Table Row (tr)
idname
Table Cell (td)
hasOwnProperty
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasOwnProperty
Span
stylefloat: left;
idiets
(propertyName)
Table Row (tr)
iddes
Table Cell (td)
Returns true if the XML object the method is called on has a property of that name.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} propertyName
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.hasOwnProperty(propertyName)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idhasSimpleContent
classnode
Table Row (tr)
idname
Table Cell (td)
hasSimpleContent
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
hasSimpleContent
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns true for XML objects of node kind text or attribute. For XML objects of node kind
element it returns true if the element has no child elements and false otherwise.
For other node kinds (comment, processing instruction) the method always returns false.
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.hasSimpleContent()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idinScopeNamespaces
classnode
Table Row (tr)
idname
Table Cell (td)
inScopeNamespaces
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
inScopeNamespaces
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array of Namespace objects representing the namespace that are in scope for this XML object.
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.inScopeNamespaces()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idinsertChildAfter
classnode
Table Row (tr)
idname
Table Cell (td)
insertChildAfter
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
insertChildAfter
Span
stylefloat: left;
idiets
(childToInserAfter, childToInsert)
Table Row (tr)
iddes
Table Cell (td)
Takes two arguments, an existing child to insert after and the new child to be inserted.
If the first argument is null then the second argument is inserted as the first child of this XML.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{XML} childToInserAfter
{XML} childToInsert
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.insertChildAfter(childToInsertAfter, childToInsert)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idinsertChildBefore
classnode
Table Row (tr)
idname
Table Cell (td)
insertChildBefore
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
insertChildBefore
Span
stylefloat: left;
idiets
(childToInsertBefore, childToInsert)
Table Row (tr)
iddes
Table Cell (td)
Takes two arguments, an existing child to insert before and the new child to be inserted.
If the first argument is null then the child is inserted as the last child.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{XML} childToInsertBefore
{XML} childToInsert
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.insertChildBefore(childToInsertBefore, childToInsert)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlength
classnode
Table Row (tr)
idname
Table Cell (td)
length
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Number
Span
stylefloat: left; font-weight: bold;
idiets
length
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
This always returns 1. This is done to blur the distinction between an XML object and an XMLList
containing exactly one value.
Table Row (tr)
idret
Table Cell (td)
Returns
Number
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.length()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idlocalName
classnode
Table Row (tr)
idname
Table Cell (td)
localName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
localName
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
returns the local name part if the XML object has a name.
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.localName()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idname
classnode
Table Row (tr)
idname
Table Cell (td)
name
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
QName
Span
stylefloat: left; font-weight: bold;
idiets
name
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the qualified name (a QName object) of the XML object it is called
Table Row (tr)
idret
Table Cell (td)
Returns
QName
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.name()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnamespace
classnode
Table Row (tr)
idname
Table Cell (td)
namespace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Namespace
Span
stylefloat: left; font-weight: bold;
idiets
namespace
Span
stylefloat: left;
idiets
([prefix])
Table Row (tr)
iddes
Table Cell (td)
If no argument is passed to the method then it returns the namespace associated with the qualified
name of this XML object. If a prefix is passed to the method then it looks for a matching namespace
in the in scope namespace of this XML object and returns it when found, otherwise undefined is returned.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} [prefix]
Table Row (tr)
idret
Table Cell (td)
Returns
Namespace
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.namespace([prefix])
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnamespaceDeclarations
classnode
Table Row (tr)
idname
Table Cell (td)
namespaceDeclarations
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Array
Span
stylefloat: left; font-weight: bold;
idiets
namespaceDeclarations
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an array with the namespace declarations associated with the XML object it is called on.
Table Row (tr)
idret
Table Cell (td)
Returns
Array
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.namespaceDeclarations()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnodeKind
classnode
Table Row (tr)
idname
Table Cell (td)
nodeKind
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
nodeKind
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a string denoting the kind of node this XML object represents. Possible values: 'element',
'attribute', 'text', 'comment', 'processing-instruction'.
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.nodeKind()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idnormalize
classnode
Table Row (tr)
idname
Table Cell (td)
normalize
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
normalize
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns this XML object after normalizing all text content.
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.normalize()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idparent
classnode
Table Row (tr)
idname
Table Cell (td)
parent
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
parent
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns the parent XML object of this XML object or null if there is no parent.
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.parent()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idprependChild
classnode
Table Row (tr)
idname
Table Cell (td)
prependChild
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
prependChild
Span
stylefloat: left;
idiets
(childToPrepend)
Table Row (tr)
iddes
Table Cell (td)
Iinserts the given value as the first child of the XML object and returns the XML object.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{XML} childToPrepend
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.prependChild(childToPrepend)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idprocessingInstructions
classnode
Table Row (tr)
idname
Table Cell (td)
processingInstructions
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
processingInstructions
Span
stylefloat: left;
idiets
([name])
Table Row (tr)
iddes
Table Cell (td)
If no argument is passed in then the method returns an XMLList with all the children of the XML
object which are processing instructions. If an argument is passed in then the method returns an
XMLList with all children of the XML object which are processing instructions where the name
matches the argument.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} [name]
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.processingInstructions([name])
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idpropertyIsEnumerable
classnode
Table Row (tr)
idname
Table Cell (td)
propertyIsEnumerable
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Boolean
Span
stylefloat: left; font-weight: bold;
idiets
propertyIsEnumerable
Span
stylefloat: left;
idiets
(propertyName)
Table Row (tr)
iddes
Table Cell (td)
Returns true if the property name is '0' and false otherwise.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} propertyName
Table Row (tr)
idret
Table Cell (td)
Returns
Boolean
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.propertyIsEnumerable(propertyName)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idremoveNamespace
classnode
Table Row (tr)
idname
Table Cell (td)
removeNamespace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
removeNamespace
Span
stylefloat: left;
idiets
(namespace)
Table Row (tr)
iddes
Table Cell (td)
Removes the namespace from the in scope namespaces of this XML object if the namespace
is not used for the qualified name of the object or its attributes.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Namespace} namespace
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.removeNamespace(namespace)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idreplace
classnode
Table Row (tr)
idname
Table Cell (td)
replace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
replace
Span
stylefloat: left;
idiets
(propertyName, replacementValue)
Table Row (tr)
iddes
Table Cell (td)
Takes two arguments, the property name of the property / properties to be replaced, and the
value to replace the properties.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} propertyName
{XML} replacementValue
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.replace(propertyName, replacementValue)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetChildren
classnode
Table Row (tr)
idname
Table Cell (td)
setChildren
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
setChildren
Span
stylefloat: left;
idiets
(value)
Table Row (tr)
iddes
Table Cell (td)
Replaces all children of the XML object with this value. The method returns the XML object it
is called on.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} value
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.setChildren(value)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetLocalName
classnode
Table Row (tr)
idname
Table Cell (td)
setLocalName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setLocalName
Span
stylefloat: left;
idiets
(name)
Table Row (tr)
iddes
Table Cell (td)
Changes the local name of this XML object to the name passed in.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} name
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.setLocalName(name)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetName
classnode
Table Row (tr)
idname
Table Cell (td)
setName
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setName
Span
stylefloat: left;
idiets
(name)
Table Row (tr)
iddes
Table Cell (td)
Replaces the name of this XML object with the name passed in.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{String} name
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.setName(name)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetNamespace
classnode
Table Row (tr)
idname
Table Cell (td)
setNamespace
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setNamespace
Span
stylefloat: left;
idiets
(namespace)
Table Row (tr)
iddes
Table Cell (td)
Changes the namespace associated with the name of this XML object to the new namespace.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Namespace} namespace
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.setNamespace(namespace)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsetSettings
classnode
Table Row (tr)
idname
Table Cell (td)
setSettings
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
void
Span
stylefloat: left; font-weight: bold;
idiets
setSettings
Span
stylefloat: left;
idiets
([settings])
Table Row (tr)
iddes
Table Cell (td)
Allows the global XML settings to be adjusted or restored to their default values.
Table Row (tr)
idprs
Table Cell (td)
Parameters
{Object} [settings] – The new settings that should be applied globally to the XML object.
Table Row (tr)
idret
Table Cell (td)
Returns
void
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.setSettings(settings)
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idsettings
classnode
Table Row (tr)
idname
Table Cell (td)
settings
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
Object
Span
stylefloat: left; font-weight: bold;
idiets
settings
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an object containing the global XML settings.
Table Row (tr)
idret
Table Cell (td)
Returns
Object
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.settings()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idtext
classnode
Table Row (tr)
idname
Table Cell (td)
text
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XMLList
Span
stylefloat: left; font-weight: bold;
idiets
text
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns an XMLList with all the children of this XML object that represent text nodes.
Table Row (tr)
idret
Table Cell (td)
Returns
XMLList
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.text()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idtoString
classnode
Table Row (tr)
idname
Table Cell (td)
toString
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
toString
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a convenient string value of this XML object.
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.toString()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idtoXMLString
classnode
Table Row (tr)
idname
Table Cell (td)
toXMLString
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
String
Span
stylefloat: left; font-weight: bold;
idiets
toXMLString
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
Returns a string with the serialized XML markup for this XML object. XML.prettyPrinting
and XML.prettyIndent settings affect the returned string.
Table Row (tr)
idret
Table Cell (td)
Returns
String
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.toXMLString()
Table Row (tr)
classlastDetailRow
Table Cell (td)

Table Body (tbody)
idvalueOf
classnode
Table Row (tr)
idname
Table Cell (td)
valueOf
Table Row (tr)
idsig
Table Cell (td)
Span
stylefloat: left; margin-right: 5px;
XML
Span
stylefloat: left; font-weight: bold;
idiets
valueOf
Span
stylefloat: left;
idiets
()
Table Row (tr)
iddes
Table Cell (td)
The method simply returns the XML object it is called on.
Table Row (tr)
idret
Table Cell (td)
Returns
XML
Table Row (tr)
idsam
Table Cell (td)
Sample
Div
classsIndent
Code Block
languagejavascript
xml.valueOf()
Table Row (tr)
classlastDetailRow
Table Cell (td)