Xquery, repeating elements, Sleepycat's DB XML

Discussion in 'XML' started by Bob, Nov 16, 2005.

  1. Bob

    Bob Guest

    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
     
    Bob, Nov 16, 2005
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang Lipp
    Replies:
    1
    Views:
    418
    Patrick TJ McPhee
    Jan 30, 2004
  2. Wolfgang Lipp
    Replies:
    0
    Views:
    497
    Wolfgang Lipp
    Jan 28, 2004
  3. Bob X

    Sleepycat DBXML included?

    Bob X, Nov 8, 2003, in forum: Python
    Replies:
    5
    Views:
    346
    flori
    Nov 10, 2003
  4. Skip Montanaro

    Re: Sleepycat Bsdbd 4.3.27 and Python 2.4.1

    Skip Montanaro, May 12, 2005, in forum: Python
    Replies:
    0
    Views:
    389
    Skip Montanaro
    May 12, 2005
  5. Replies:
    2
    Views:
    1,073
    Jean-Roch SOTTY
    Dec 5, 2005
Loading...

Share This Page