FOM Reference > DOM Support > DOM > XPathResult interface
  
XPathResult interface
The XPathResult interface represents the result of the evaluation of an XPath 1.0 expression within the context of a particular node. Since evaluation of an XPath expression can result in various result types, this object makes it possible to discover and manipulate the type and value of the result.
XPathResultType enumeration
An integer indicating what type of result this is.
If a specific type is specified, then the result will be returned as the corresponding type, using XPath typeconversions where required and possible.
The XPathResultType enumeration has the following constants of type unsigned short.
ANY_TYPE = 0
This code does not represent a specific type. An evaluation of an XPath expression will never produce this type. If this type is requested, then the evaluation returns whatever type naturally results from evaluation of the expression.
If the natural result is a node set when ANY_TYPE was requested, then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type. Any other representation of a node set must be explicitly requested.
NUMBER_TYPE = 1
The result is a number as defined by [XPath 1.0]. Document modification does not invalidate the number, but may mean that reevaluation would not yield the same number.
STRING_TYPE = 2
The result is a string as defined by [XPath 1.0]. Document modification does not invalidate the string, but may mean that the string no longer corresponds to the current document.
BOOLEAN_TYPE = 3
The result is a boolean as defined by [XPath 1.0]. Document modification does not invalidate the boolean, but may mean that reevaluation would not yield the same boolean.
NODELIST_TYPE = 51
The result is a live NodeList that may not be in a particular order. Document modification does not invalidate the list but may mean that reevaluation would not yield the same list and nodes in the list may be altered, moved, or removed from the document.
booleanValue attribute
The value of this boolean result.
booleanValue
Access
read-only
Returns
boolean
Get throws
XPathException
TYPE_ERR: raised if resultType is not BOOLEAN_TYPE.
nodeListValue attribute
The NodeList result of the expression. Unlike the iterator result, the nodeList does not become invalid.
nodeListValue
Access
read-only
Returns
NodeList
Get throws
XPathException
TYPE_ERR: raised if resultType is not NODELIST_TYPE or
numberValue attribute
The value of this number result.
numberValue
Access
read-only
Returns
float
Get throws
XPathException
TYPE_ERR: raised if resultType is not NUMBER_TYPE.
resultType attribute
A code representing the type of this result, as defined by the type constants.
resultType
Access
read-only
Returns
unsigned short
stringValue attribute
The value of this string result.
stringValue
Access
read-only
Returns
String
Get throws
XPathException
TYPE_ERR: raised if resultType is not STRING_TYPE.