XPathResult Class
https://dom.spec.whatwg.org/#interface-xpathresult (https://www.w3.org/TR/DOM-Level-3-XPath/xpath.html#XPathResult)
public sealed class XPathResultProperties
| Name | Description |
|---|---|
| BooleanValue | Gets the boolean of the result; throws a TypeError when the result is not a boolean. |
| InvalidIteratorState | Whether the document was modified since the result was created, which invalidates iterators. |
| NumberValue | Gets the number of the result; throws a TypeError when the result is not a number. |
| ResultType | Gets the type of the result, one of the *_TYPE constants. |
| SingleNodeValue | Gets the node of the result, or null when none matched; throws a TypeError when the result is not a single node. |
| SnapshotLength | Gets the number of nodes of the snapshot; throws a TypeError when the result is not a snapshot. |
| StringValue | Gets the string of the result; throws a TypeError when the result is not a string. |
BooleanValue
XPathApi.csGets the boolean of the result; throws a TypeError when the result is not a boolean.
public bool BooleanValue { get; }InvalidIteratorState
XPathApi.csWhether the document was modified since the result was created, which invalidates iterators.
public bool InvalidIteratorState { get; }NumberValue
XPathApi.csGets the number of the result; throws a TypeError when the result is not a number.
public double NumberValue { get; }ResultType
XPathApi.csGets the type of the result, one of the *_TYPE constants.
public ushort ResultType { get; }SingleNodeValue
XPathApi.csGets the node of the result, or null when none matched; throws a TypeError when the result is not a single node.
public Node? SingleNodeValue { get; }SnapshotLength
XPathApi.csGets the number of nodes of the snapshot; throws a TypeError when the result is not a snapshot.
public uint SnapshotLength { get; }StringValue
XPathApi.csGets the string of the result; throws a TypeError when the result is not a string.
public string StringValue { get; }Methods
| Name | Description |
|---|---|
| IterateNext() | Returns the next node of the iterator, or null at the end; throws an InvalidStateError when the document was modified. |
| SnapshotItem(uint) | Returns the node of the snapshot at the given index, or null when the index is out of range. |
IterateNext()
XPathApi.csReturns the next node of the iterator, or null at the end; throws an InvalidStateError when the document was modified.
public Node? IterateNext()SnapshotItem(uint)
XPathApi.csReturns the node of the snapshot at the given index, or null when the index is out of range.
Constants
| Name | Description |
|---|---|
| AnyType | The type that lets the evaluation choose the natural type of the result. |
| AnyUnorderedNodeType | A single node, any of the matching ones. |
| BooleanType | A single boolean. |
| FirstOrderedNodeType | A single node, the first matching one in document order. |
| NumberType | A single number. |
| OrderedNodeIteratorType | An iterator over the nodes, in document order. |
| OrderedNodeSnapshotType | A snapshot of the nodes, in document order. |
| StringType | A single string. |
| UnorderedNodeIteratorType | An iterator over the nodes, in any order. |
| UnorderedNodeSnapshotType | A snapshot of the nodes, in any order. |
AnyType
The type that lets the evaluation choose the natural type of the result.
public const ushort AnyType = 0AnyUnorderedNodeType
A single node, any of the matching ones.
public const ushort AnyUnorderedNodeType = 8BooleanType
A single boolean.
public const ushort BooleanType = 3FirstOrderedNodeType
A single node, the first matching one in document order.
public const ushort FirstOrderedNodeType = 9NumberType
A single number.
public const ushort NumberType = 1OrderedNodeIteratorType
An iterator over the nodes, in document order.
public const ushort OrderedNodeIteratorType = 5OrderedNodeSnapshotType
A snapshot of the nodes, in document order.
public const ushort OrderedNodeSnapshotType = 7StringType
A single string.
public const ushort StringType = 2UnorderedNodeIteratorType
An iterator over the nodes, in any order.
public const ushort UnorderedNodeIteratorType = 4UnorderedNodeSnapshotType
A snapshot of the nodes, in any order.
public const ushort UnorderedNodeSnapshotType = 6