Specifications
18.4 XML module
Node class
Node is the abstract base class for the Document, Element, Text, and Comment classes. A Node
object represents a node in the XML tree of one of those types.
Accessing node properties
Returns the node type (“Document”, “Element”, “Text”,
“Comment” or “Attr”).
getNodeType() : String
Returns the document object in which this node resides.
getOwnerDocument() : Document
Returns this node’s parent node or null if this node is a
document or if this node is not currently part of a node
hierarchy.
getParentNode() : Node
Evaluating XPath expressions
The functions presented here evaluate an XPath 1.0 expression in the context of the node being
queried.
Namespaces
Namespace prefixes in the query expression are resolved into namespace URIs using the prefix
map provided to the query functions as a second argument. If the map argument is omitted or
null, the default prefix map is used for resolving prefixes.
Result data types
The value of an XPath 1.0 expression can have several data types (a node set with several elements,
the text value of an attribute, a number returned by the count() function, the Boolean result of
a comparison). The value is converted to the function's result data type using XPath 1.0 semantics
– which may very well differ from the conversion semantics in the scripting language. For example
the XPath 1.0 conversion from string to Boolean returns true for all non-empty strings (including
the string “false”).
Functions
Evaluates an XPath 1.0 expression in the node’s context.
If the result is a non-empty node-set, returns a list of
the nodes in the set. Otherwise returns an empty list.
evalToNodes( xpath : String,
prefix-map : Map ) : NodeList
Evaluates an XPath 1.0 expression in the node’s context.
If the result is a non-empty node-set, returns the first
node in the set. Otherwise returns null.
evalToNode( xpath : String,
prefix-map : Map ) : Node
Evaluates an XPath 1.0 expression in the node’s context
and converts the result to a string value with the XPath
1.0 string() function.
evalToString( xpath : String,
prefix-map : Map ) : String
426
Enfocus Switch 10