The following object properties can be used in custom JavaScript functions for any
node, such as nodes passed as parameters or the current context:
- parent - Returns the parent node, if a parent
node exists. Returns null if none exists.
- attributes - Returns an array of attribute
nodes.
- localName - Returns the local name of the
node (no namespace).
- uri - Returns the namespace of the node.
- value - Returns the value of the node, depending
on the node type.
- nodeType - Returns the type of the node as
a string. One of the following strings is returned: element
attribute text document none
- firstChild - Returns the first child node
of the node. Returns null if there is no child.
- nextSibling - Returns the next sibling of
this node. Returns null if there is no next sibling.
- previousSibling - Returns the previous sibling
of this node. Returns null if there is no previous sibling
Example Using Node Properties
The following
example uses the current context node and node properties to find
a node named “PickMe”.
var myNode;
myNode = this.current //the current context node
for (myNode = myNode.firstChild; myNode != null; myNode = myNode.nextSibling) {
if (myNode.localName == “PickMe”) {
return true;
}
}
return false;
Custom functions also have access
to the current context node of the map using the standard "this” variable.
For more information, see Object properties for the current context.