recursive schema: see a problem?

Discussion in 'XML' started by KJ, Sep 21, 2005.

  1. KJ

    KJ Guest

    Hello,

    I am trying to define a recursive element in this schema. Is there an
    error with the following:

    <xs:complexType name="SystemType">
    <xs:sequence maxOccurs="unbounded">
    <xs:choice maxOccurs="unbounded">
    <xs:element minOccurs="0" maxOccurs="unbounded"
    name="SubSystem">
    <xs:complexType>
    <xs:sequence>
    <xs:element ref="Operation" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element ref="SubSystem" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    <xs:attribute ref="SubSystemId" />
    <xs:attribute ref="SystemId" />
    </xs:complexType>
    </xs:element>
    <xs:element ref="Operation" />
    </xs:choice>
    </xs:sequence>
    <xs:attribute ref="SystemId" />
    <xs:attribute ref="Name" />
    </xs:complexType>

    -KJ
     
    KJ, Sep 21, 2005
    #1
    1. Advertising

  2. KJ writes:

    > I am trying to define a recursive element in this schema. Is there an
    > error with the following:
    >
    > <xs:complexType name="SystemType">

    . . .
    > <xs:element minOccurs="0" maxOccurs="unbounded" name="SubSystem">
    > <xs:complexType>
    > <xs:sequence>

    . . .
    > <xs:element ref="SubSystem" minOccurs="0" maxOccurs="unbounded"/>


    Won't work -- you can only refer to elements declared at the top
    level.

    Move the declaration of SubSystem up to the top level, replacing it
    within SystemType by <xs:element ref="SubSystem"
    minOccurs="0" maxOccurs="unbounded"/>

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Sep 26, 2005
    #2
    1. Advertising

  3. KJ

    KJ Guest

    Thanks!
     
    KJ, Sep 27, 2005
    #3
    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. Markus
    Replies:
    1
    Views:
    1,678
    Markus
    Nov 23, 2005
  2. Stanimir Stamenkov
    Replies:
    3
    Views:
    1,335
    Stanimir Stamenkov
    Apr 25, 2005
  3. =?ISO-8859-1?Q?Gregory_Pi=F1ero?=

    Recursive function going infinite and I can't see why.

    =?ISO-8859-1?Q?Gregory_Pi=F1ero?=, Feb 4, 2006, in forum: Python
    Replies:
    4
    Views:
    353
    =?ISO-8859-1?Q?Gregory_Pi=F1ero?=
    Feb 5, 2006
  4. n00m
    Replies:
    12
    Views:
    1,145
  5. vamsi
    Replies:
    21
    Views:
    2,155
    Keith Thompson
    Mar 9, 2009
Loading...

Share This Page