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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

xquery

Status
Not open for further replies.

saadabc

Programmer
Joined
Aug 5, 2004
Messages
107
Location
US
I don't know if i should post an xquery related question here ....

let's say my xml document is called abc.xml and looks like this:


<root>
<parent>
<childA>stuff</childA>
<childB>stuff</childB>
<childC>stuff</childC>
</parent>
<parent>
<childA>stuff 2</childA>
<childC>stuff 2</childC>
</parent>

<parent>
<childA>stuff 3</childA>
<childB>stuff 3</childB>
</parent>

</root>


I want to write an XQuery that would iterate through parents and will return parents for which childB tag exists or not.

how do i do this ?

it would start something like:

for $b in document("abc.xml")\root
where // <childB> does not exist - how do i check this
return <parent> ..... </parent>
 
Code:
for $b in doc("abc.xml")/root/parent
where $b/childB
return $b

Jon

"I don't regret this, but I both rue and lament it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top