XML Functions and Methods

This page discusses:

XML Loading

Function Input Types Return Type Description
XMLPARSE(filenameOrString) String XmlNode Gets the root element node loaded from the specified filename or string.

XmlNode Basics

Function Input Types Return Type Description
tagName - String Gets or sets the tag name from this element node.
parent - XmlNode Gets or sets the parent node from this element node.
entity - Entity_ Gets or sets user data for this element node.

Get Attributes

Function Input Types Return Type Description
attributeNames() - String Gets the attribute names defined on this element node.
getAttribute(name) String String Gets the specified attribute value from this element node.
getBooleanAttribute(String) String String Gets the specified attribute value converted as Boolean from this element node.

Get XML Hierarchy

Function Input Types Return Type Description
childNodes() - Entity_ Gets the strings and element nodes contained in this element node.
elementNodes() - XmlNode Gets the element nodes contained in this element node.
nextSibling() - XmlNode Gets the next element node that has the same parent as this node.
previousSibling() - XmlNode Gets the previous element node that has the same parent as this node.

Get XML or Text Content

Function Input Types Return Type Description
xml() - String Gets an XML representation from this element node.
text() - String Gets a text extracted from this element node and its descendants.

Set Attributes

Function Input Types Return Type Description
setAttribute(name, value) String, String String Sets the specified attribute value for this element node.
setBooleanAttribute(name, value) String, String String Sets the specified Boolean attribute value for this element node.
removeAttribute(name) String XmlNode Removes the specified attribute, and then returns the receiver element node.

Manipulating Hierarchy

Function Input Types Return Type Description
delete() - XmlNode Removes the element node from its parent, and then returns nothing.
newChild(tagName) String XmlNode Creates a child element node with specified a tag name, and then returns it.
appendChild(child) Entity_ XmlNode Appends the child string or element nodes specified as argument, and then returns the receiver node.
removeChild(child) Entity_ XmlNode Removes the child string or element nodes specified as argument, and then returns the receiver node.
insertBefore(child, before) XmlNode, XmlNode XmlNode Inserts the element node specified in 1st argument as child node before the other child element node specified in 2nd argument, and then return the receiver node.

Finding Element Nodes

Function Input Types Return Type Description
getElementById(id) String XmlNode Gets the first element node with specified ID.
getElementByName(tagName) String XmlNode Gets the first element node with specified tag name.
getElementByNameAndAttribute(tagName, name, value) String, String, String XmlNode Gets the first element node with specified tag name and attribute value.
getElementsByName(tagName) String XmlNode Gets all element nodes with specified tag name.
getElementsByNameAndAttribute(tagName, name, value) String, String, String XmlNode Gets all element nodes with specified tag name and attribute value.