nsIDOMXPathResult 编辑
dom/interfaces/xpath/nsIDOMXPathResult.idl
Scriptable This interface describes an XPath result returned by nsIDOMXPathEvaluator or document.evaluate Inherits from: nsISupports
Last changed in Gecko 1.7Method overview
nsIDOMNode iterateNext(); |
nsIDOMNode snapshotItem(in unsigned long index); |
Attributes
Attribute | Type | Description |
booleanValue | boolean | If resultType is BOOLEAN_TYPE , the boolean value. Read only. |
invalidIteratorState | boolean | true if the iterator state has become invalid. For example, modifying a node invalidates the iterator. Read only. |
numberValue | double | If resultType is NUMBER_TYPE , the numeric value of the XPath value. Read only. |
resultType | unsigned short | The type of result; can be any of the Type constants except ANY_TYPE. Read only. |
singleNodeValue |
| If resultType is ANY_UNORDERED_NODE_TYPE or FIRST_ORDERED_NODE_TYPE , a single DOM Node. Read only. |
snapshotLength | unsigned long | If resultType is UNORDERED_NODE_SNAPSHOT_TYPE or ORDERED_NODE_SNAPSHOT_TYPE , the length of the snapshort array. Read only. |
stringValue | DOMString | If resultType is STRING_TYPE , the boolean value. Read only. |
Constants
Type constants
Constant | Value | Description |
ANY_TYPE | 0 | Used when evaluating an XPath expression; the evaluator will return the most appropriate type. |
NUMBER_TYPE | 1 | Type is a single number. |
STRING_TYPE | 2 | Type is a single string. |
BOOLEAN_TYPE | 3 | Type is a single boolean value. |
UNORDERED_NODE_ITERATOR_TYPE | 4 | Type is a reference to all the nodes matching the expression used in the evaluator. The nodes may not necessarily be in the same order that they appear in the document. |
ORDERED_NODE_ITERATOR_TYPE | 5 | Type is a reference to all the nodes matching the expression used in the evaluator. The nodes in the result set are in the same order that they appear in the document. |
UNORDERED_NODE_SNAPSHOT_TYPE | 6 | Type is a node-set containing snapshots of all the nodes matching the expression used in the evaluator. The nodes may not necessarily be in the same order that they appear in the document. |
ORDERED_NODE_SNAPSHOT_TYPE | 7 | Type is a node-set containing snapshots of all the nodes matching the expression used in the evaluator. The nodes in the result set are in the same order that they appear in the document. |
ANY_UNORDERED_NODE_TYPE | 8 | Type is a single node that matches the expression. The node is not necessarily the first node in the document that matches the expression used in the evaluator. |
FIRST_ORDERED_NODE_TYPE | 9 | Type is the first node in the document that matches the expression used in the evaluator. |
Methods
iterateNext()
Iterates through the available nodes of an UNORDERED_NODE_ITERATOR_TYPE
or ORDERED_NODE_ITERATOR_TYPE
result.
nsIDOMNode iterateNext();
Parameters
None.
Return value
A DOM node
.
snapshotItem()
Returns the specified node from what is essentially an array of resulting DOM node
s. Is only available if the result type is UNORDERED_NODE_SNAPSHOT_TYPE
or ORDERED_NODE_SNAPSHOT_TYPE.
nsIDOMNode snapshotItem( in unsigned long index );
Parameters
index
- The index of the DOM node to return.
Return value
A DOM node
.
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论