0

I have this XML document:

<root>
  <node1 id="field2"/>
  <node2 id="field3"/>
  <node3>
    <node4 id="field4"/>
  </node3>
</root>

where the common thing is the attribute named id. I would like to get all the nodes that has an attribute named "id" - regardless of level. In this example i would end up with a list of the nodes: node1, node2, node4.

Normally i would try an xpath like this: "//[@id]" but im getting an error saying that it need to return a node set.

4

1 回答 1

0

您可以使用以下 XPath:

//node()[@id]
于 2013-01-18T14:31:04.010 回答