Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting element names using XPath/XQuery

Tags:

xpath

xquery

having the following XML sample document, I need to issue an XPath/XQuery expression to get the element names for every children of a CD element.

<CD>
  <TITLE>Empire Burlesque</TITLE>
  <ARTIST>Bob Dylan</ARTIST>
  <COUNTRY>USA</COUNTRY>
  <COMPANY>Columbia</COMPANY>
  <PRICE>10.90</PRICE>
  <YEAR>1985</YEAR>
</CD>

So I need the query to return TITLE, ARTIST, COUNTRY, COUNTRY, PRICE, YEAR , any one can help please? thanks

like image 970
Lucy Avatar asked Jun 20 '12 13:06

Lucy


1 Answers

/CD/*/name()

(padded out because StackOverflow doesn't like short answers)

like image 146
Michael Kay Avatar answered Oct 13 '22 10:10

Michael Kay