Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPath wildcards for element name. 1

Status
Not open for further replies.

PeterOcean

Programmer
Mar 26, 2002
27
0
0
CA
To keep things simple, I have an XML like this:

<root>
<childA/>
<childB/>
<somethingelse/>
</root>


and i would like to use XPath (if possible) to give me all the child element of <root> that start with "child". So something like \root\child*

Is this possible and how?

Many Thanks
 
You might consider rewriting your xml-structure:
<root>
<child @type="A"/>
<child @type="B"/>
<somethingelse/>
</root>
is easier to handle.

Anayway: this will do the trick:

root/*[substring(name(),1,5)='child']
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top