Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > defining schema for recursive element

Reply
Thread Tools

defining schema for recursive element

 
 
Louise
Guest
Posts: n/a
 
      06-09-2005
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

 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      06-10-2005


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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Including element from one schema namespace in another schema namespace mflll@wiu.edu XML 1 07-20-2006 06:48 AM
[XML Schema] Including a schema document with absent target namespace to a schema with specified target namespace Stanimir Stamenkov XML 3 04-25-2005 09:59 AM
defining or not defining destructors johny smith C++ 8 07-02-2004 08:51 AM
per the active schema, the element <BR> must be included within a parent element MSNews ASP .Net 1 04-22-2004 04:45 PM
In Schema, how to say "If one element exist, another element must exist"? Y.S. XML 3 09-17-2003 02:51 PM



Advertisments