读书人

在javascript中施用xpath

发布时间: 2012-10-20 14:12:48 作者: rapoo

在javascript中使用xpath

原文来自:?https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript

?

?

This could inadvertently grab some elements if one of its attributes existed that had a local name of "href", but it was a different attribute which had the targeted (XLink) namespace (instead of?@href).

In order to accurately grab elements with the XLink?@href?attribute (without also being confined to predefined prefixes in a namespace resolver), one could obtain them as follows:

DescriptionANY_TYPE0A result set containing whatever type naturally results from evaluation of the expression. Note that if the result is a node-set then UNORDERED_NODE_ITERATOR_TYPE is always the resulting type.NUMBER_TYPE1A result containing a single number. This is useful for example, in an XPath expression using the?count()?function.STRING_TYPE2A result containing a single string.BOOLEAN_TYPE3A result containing a single boolean value. This is useful for example, in an XPath expression using the?not()?function.UNORDERED_NODE_ITERATOR_TYPE4A result node-set containing all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document.ORDERED_NODE_ITERATOR_TYPE5A result node-set containing all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document.UNORDERED_NODE_SNAPSHOT_TYPE6A result node-set containing snapshots of all the nodes matching the expression. The nodes may not necessarily be in the same order that they appear in the document.ORDERED_NODE_SNAPSHOT_TYPE7A result node-set containing snapshots of all the nodes matching the expression. The nodes in the result set are in the same order that they appear in the document.ANY_UNORDERED_NODE_TYPE8A result node-set containing any single node that matches the expression. The node is not necessarily the first node in the document that matches the expression.FIRST_ORDERED_NODE_TYPE9A result node-set containing the first node in the document that matches the expression.

?

读书人网 >JavaScript

热点推荐