DO NOT EDIT THE CONTENT OF THIS PAGE DIRECTLY (EXCEPT INSIDE THE DIV BELOW WITH ID=DESCRIPTION), UNLESS YOU KNOW WHAT YOU'RE DOING. THE STRUCTURE OF THE CONTENT IS VITAL IN BEING ABLE TO AUTO UPDATE THE CONTENT THROUGH THE DOC GENERATOR.
Div
id
description
How to script XML
Code Block
language
js
title
Creating XML objects from a string
var myXml = new XML('<test level="1"><test2 level="2">A value</test2></test>');
Code Block
language
js
title
Creating XML objects using XML object notation
var myXml =
<test level="1">
<test2 level="2">A value</test2>
</test>;
Code Block
language
js
title
Using JavaScript variables inside XML
var myValue = 'hello, some value!';
var myXml =
<test level="1">
<test2 level="2">{myValue}</test2>
</test>;
Code Block
language
js
title
Accessing nodes in the XML
var myXml = new XML('<test level="1"><test2 level="2">A value</test2></test>');
application.output(myXml.test2.toString()); //outputs 'A value'
Code Block
language
js
title
Accessing a specific index on subnodes
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].toXMLString()); //outputs '<test2 level="2">Another value</test2>'
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.
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.
processingInstructions() If no argument is passed in then the method returns an XMLList with all the children of the XML object which are processing instructions.
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.
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.
replace(propertyName, replacementValue) Takes two arguments, the property name of the property / properties to be replaced, and the value to replace the properties.
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)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
ignoreProcessingInstructions
Table Row (tr)
id
name
Table Cell (td)
ignoreProcessingInstructions
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
If set to true, then processing instructions are ignored when constructing new XML objects.
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)
class
lastDetailRow
Table Cell (td)
Table Body (tbody)
id
ignoreWhitespace
Table Row (tr)
id
name
Table Cell (td)
ignoreWhitespace
Table Row (tr)
id
des
Table Cell (td)
Div
class
sIndent
If set to true, then whitespace in the XML is ignored when constructing new XML objects.
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.
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.
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.
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.
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.
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.
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.
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.
Returns a string denoting the kind of node this XML object represents. Possible values: 'element', 'attribute', 'text', 'comment', 'processing-instruction'.
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.
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.
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.