dbTalk Databases Forums  

XQuery question

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss XQuery question in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sandesh
 
Posts: n/a

Default XQuery question - 12-28-2005 , 07:26 AM






Hi!
I am struggling to query a part of the node

eg:
I have node
<root>
<a>
It starts with
<tag1>hello</tag1>
I need This Content
<tag2>I need this too</tag2>
I need Till here
<tag3>goodbye</tag3>.
</a>
</root>

Here I want to get the content which are in between <tag1> and <tag3>
( i.e
I need This Content
<tag2>I need this too</tag2>
I need Till here
)

Is it possible to query for this ? If yes please give an example

Regards
Sandesh


Reply With Quote
  #2  
Old   
George Feinberg
 
Posts: n/a

Default Re: XQuery question - 01-03-2006 , 10:08 AM






Sandesh,

This is a generic question on XQuery. There is no
way to query for a "range" of child nodes as you might
expect. You have to just ask for them individually.
Using BDB XML's dbxml shell program and your test program,
this query would work, assuming you've created an
in-memory container (path is ""), and inserted a document
that looks like your example:

dbxml> query "for $a in collection('')/root/a
return ($a/text()[2],$a/child::tag2,$a/text()[3])"
3 objects returned for eager expression 'for $a in
collection('')/root/a
return ($a/text()[2],$a/child::tag2,$a/text()[3])'


dbxml> print
I need This Content

<tag2>I need this too</tag2>
I need Till here


Regards,

George
Sleepycat Software

sandesh wrote:
Quote:
Hi!
I am struggling to query a part of the node

eg:
I have node
root
a
It starts with
tag1>hello</tag1
I need This Content
tag2>I need this too</tag2
I need Till here
tag3>goodbye</tag3>.
/a
/root

Here I want to get the content which are in between <tag1> and <tag3
( i.e
I need This Content
tag2>I need this too</tag2
I need Till here
)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.