为所有节点获取XPATH [英] get XPATH for all the nodes
问题描述
是否有任何库可以为我的所有HTML页面中的节点提供XPATH?
是否有任何库可以给我
XPATH用于HTML页面中的所有节点
是的,如果这个HTML页面是格式良好的XML文档。
取决于您对节点的理解...
// *
选择所有文档中的元素。
/ descendant-or-self :: node()
选择所有元素,文本节点,处理指令,注释节点和根节点 /
。
// text()
选择文档中的所有文本节点。
// comment()
选择文档中的所有注释节点。
//处理指令()
选择文档中的所有处理指令。
// @ *
选择文档中的所有属性节点。
//命名空间:: *
选择文档中的所有名称空间节点。
最后,可以使用union( 因此,我认为下面的表达式确实选择了任何XML文档的所有节点: is there any library that can give me XPATH for all the nodes in HTML page ? is there any library that can give me
XPATH for all the nodes in HTML page Yes, if this HTML page is a well-formed XML document. Depending on what you understand by "node"... selects all the elements in the document. selects all elements, text nodes, processing instructions, comment nodes, and the root node selects all text nodes in the document. selects all comment nodes in the document. selects all processing instructions in the document. selects all attribute nodes in the document. selects all namespace nodes in the document. Finally, you can combine any of the above expressions using the union ( Thus, I believe that the following expression really selects "all the nodes" of any XML document:
这篇关于为所有节点获取XPATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! | $ c)
/ descendant-or-self :: node()| // @ * | // namespace :: *
//*
/descendant-or-self::node()
/
.//text()
//comment()
//processing-instruction()
//@*
//namespace::*
|
) operator./descendant-or-self::node() | //@* | //namespace::*