Xquery, repeating elements, Sleepycat's DB XML

B

Bob

Hello,

I hope this is the right newsgroup to ask the following question about XML.

I would like to have something like the following:

<testcase>
<name>foo</name>
<type>typeA</type>
<command>foo.sh</command>
<command>foo2.sh</command>
</testcase>
<testcase>
<name>bar</name>
<type>typeB</type>
<command>bar.sh</command>
</testcase>
<testcase>
<name>zum</name>
<type>typeA</type>
<command>zum.sh</command>
</testcase>

The key point for this example is that "<command> appears more than once
in the first "<testcase>" element. I would like to be able to query the
above (using Sleepycat's DB XML) something like this:

query 'for $t in collection("")/testcase[type='typeA']/command/text()'

expecting output something like this

foo.sh
foo2.sh
zum.sh

But, I get an error about "<command>" appearing more than once. I know the
above structure is a no-no in the relational (SQL) world but I thought
I saw somethig similar to the above in other XML applications. The example
I am thinking of is a phone directory where there can be multiple phone
numbers, each with an attribute like 'type="cell"'. I tried adding dummy
attributes to my example above but it didn't help.

Is there some way to do this correctly?

Thanks,
Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top