xml - How can I select only specific subelements in XQuery? -
say have elements <country>
, , elements have lots of subelements <name>
, <population>
, <cities>
, of have own subelements. if call
for $x in doc("myfile.xml")/world return <country> { $c/country } </country>
then i'll of countries, of subelements, subelements, , on. however, want select of cities in country, including subelements of cities. how can this?
you use xpath expressions select elements in xquery.
$x/country/*
selects child elements of country.$x/country/cities
selects<cities/>
child elements$x/country/(name|population|cities)
selects specified child elements (|
union operator, , parenthesis create sequence)
Comments
Post a Comment