recursive schema: see a problem?

K

KJ

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
 
H

Henry S. Thompson

KJ said:
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: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top