0

I want to select a node together with all child nodes from an XML document that I have loaded. What method whould I use to get, for example below, <item2> and all child nodes (child 2.1,2.2,2.3)?

<xmldoc>
  <item1>
    <child1.1>
    <child1.2>
    <child1.3>
  </item1>
  <item2>
    <child2.1>
    <child2.2>
    <child2.3>
  </item2>
</xmldoc>
ActiveX
  • 47
  • 5

2 Answers2

0

The xpath expression should be /xmldoc/item2/* Otherwise you should specify in what language...

0

Assuming you need (as mentioned in question) to select item2 and all its child nodes, XPath expression will be

xmldoc/item2 | xmldoc/item2/*

And if you need all descendants (e.g. for more complicated structure)

xmldoc/item2/descendant-or-self::*
Flack
  • 5,862
  • 2
  • 23
  • 27