简体   繁体   English

XPath中// * /和/ * //之间的区别?

[英]Difference between //*/ and /*// in XPath?

I cannot figure out the difference between: 我无法弄清楚之间的区别:

/RootNode//*/@* (1)

and

/RootNode/*//@* (2)

May be (1) says "start from the RootNode go deep as you can until you find all leaves with any attribute to print and then print it" and the (2) says "Start at RootNode , take all elements (only children of RootNode ) and then go as deep as you can until you find a leaf with an attribute to print". 可能是(1)说“从RootNode开始深入,直到找到所有具有任何属性的叶子打印然后打印”,并且(2)说“从RootNode开始,取所有元素(仅RootNodeRootNode然后尽可能深,直到找到一个带有要打印属性的叶子“。 Am I wrong? 我错了吗? What is the difference between (1) and (2) ? (1)(2)之间有什么区别?

They are both equivalent. 它们都是等价的。 They both say, 他们都说,

Select all of the attributes on elements beneath the top RootNode element. 选择顶部RootNode元素下面的元素的所有属性。

Whether the * appears before or after the descendant-or-self step doesn't matter. *在后代或自我步骤之前或之后出现无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM