nsIDOMXPathResult 编辑

dom/interfaces/xpath/nsIDOMXPathResult.idlScriptable This interface describes an XPath result returned by  nsIDOMXPathEvaluator or document.evaluate Inherits from: nsISupports Last changed in Gecko 1.7

Method overview

nsIDOMNode iterateNext();
nsIDOMNode snapshotItem(in unsigned long index);

Attributes

AttributeTypeDescription
booleanValuebooleanIf resultType is BOOLEAN_TYPE, the boolean value. Read only.
invalidIteratorStatebooleantrue if the iterator state has become invalid. For example, modifying a node invalidates the iterator. Read only.
numberValuedoubleIf resultType is NUMBER_TYPE, the numeric value of the XPath value. Read only.
resultTypeunsigned shortThe type of result; can be any of the Type constants except ANY_TYPE. Read only.
singleNodeValuensIDOMNodeIf resultType is ANY_UNORDERED_NODE_TYPE orFIRST_ORDERED_NODE_TYPE, a single DOM Node. Read only.
snapshotLengthunsigned longIf resultType is UNORDERED_NODE_SNAPSHOT_TYPEorORDERED_NODE_SNAPSHOT_TYPE, the length of the snapshort array. Read only.
stringValueDOMStringIf resultType is STRING_TYPE, the boolean value. Read only.

Constants

Type constants

ConstantValueDescription
ANY_TYPE0Used when evaluating an XPath expression; the evaluator will return the most appropriate type.
NUMBER_TYPE1Type is a single number.
STRING_TYPE2Type is a single string.
BOOLEAN_TYPE3Type is a single boolean value.
UNORDERED_NODE_ITERATOR_TYPE4Type 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_TYPE5Type 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_TYPE6Type 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_TYPE7Type 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_TYPE8Type 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_TYPE9Type 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 nodes. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:114 次

字数:8460

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文