defining schema for recursive element

L

Louise

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
 
M

Martin Honnen

Louise said:
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>
 

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,013
Latest member
KatriceSwa

Latest Threads

Top