defining schema for recursive element

Discussion in 'XML' started by Louise, Jun 9, 2005.

  1. Louise

    Louise Guest

    I've looked thru the newsgroup and read a lot and I think this is legal
    (see code snippet below - type referencing itself), but my validation
    is failing when it gets to the first nested element (<task>).

    <xs:complexType name="taskType">
    <xs:sequence>
    <xs:element name="tree_resources" type="tree_resourcesType"/>
    <xs:sequence>
    <xs:element name="task" type="taskType" minOccurs="0"/>
    </xs:sequence>
    </xs:sequence>
    <xs:attribute ref="name"/>
    <xs:attribute ref="id"/>
    <xs:attribute ref="parent_id"/>
    <xs:attribute ref="startdt"/>
    <xs:attribute ref="enddt"/>
    </xs:complexType>

    Any thoughts?

    I'm a newbie... so help is appreciated.

    Thanks,
    L
    Louise, Jun 9, 2005
    #1
    1. Advertising

  2. Louise wrote:

    > I've looked thru the newsgroup and read a lot and I think this is legal
    > (see code snippet below - type referencing itself), but my validation
    > is failing when it gets to the first nested element (<task>).
    >
    > <xs:complexType name="taskType">
    > <xs:sequence>
    > <xs:element name="tree_resources" type="tree_resourcesType"/>
    > <xs:sequence>
    > <xs:element name="task" type="taskType" minOccurs="0"/>
    > </xs:sequence>


    Why that nesting, if you want the content of taskType to be a sequence
    of elements then simply use
    <xs:sequence>
    <xs:element name="tree_resources" type="..." />
    <xs:element name="task" type="taskType" minOccurs="0" />
    </xs:sequence>

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Jun 10, 2005
    #2
    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. MSNews
    Replies:
    1
    Views:
    2,711
    Alvin Bruney [MVP]
    Apr 22, 2004
  2. Markus
    Replies:
    1
    Views:
    1,497
    Markus
    Nov 23, 2005
  3. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,173
    Stanimir Stamenkov
    Apr 25, 2005
  4. johny smith
    Replies:
    8
    Views:
    403
    Peter Koch Larsen
    Jul 2, 2004
  5. Replies:
    1
    Views:
    502
    George Bina
    Jul 20, 2006
Loading...

Share This Page