Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Schema: complexType restrictions

Reply
Thread Tools

Schema: complexType restrictions

 
 
Moth
Guest
Posts: n/a
 
      08-01-2003
On my first night with schemas, things are not proceeding according to
expectations. Given three distinct complexType layouts:

<sequence> multiple elements in strict sequence
<choice> one element singled out from group of elements
<all> multiple elements in no particular order, each represented
only once

- how would you handle a typical xhtml setup with multiple elements
represented any number of times in no particular order:

<h>Heading</h>
<p>Paragraph</p>
<p>Paragraph</p>
<h>Heading</h>
<p>Paragraph</p>

The implied maxOccur of "1" on the <all> container has really thrown
me off! Thanks for any insight you may provide.

--
Moth
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      08-03-2003


Moth wrote:
> On my first night with schemas, things are not proceeding according to
> expectations. Given three distinct complexType layouts:
>
> <sequence> multiple elements in strict sequence
> <choice> one element singled out from group of elements
> <all> multiple elements in no particular order, each represented
> only once
>
> - how would you handle a typical xhtml setup with multiple elements
> represented any number of times in no particular order:
>
> <h>Heading</h>
> <p>Paragraph</p>
> <p>Paragraph</p>
> <h>Heading</h>
> <p>Paragraph</p>
>
> The implied maxOccur of "1" on the <all> container has really thrown
> me off! Thanks for any insight you may provide.


<h> is not a defined XHTML 1.0 tag but I assume you want <h1> there. As
for XHTML as a schema look at
http://www.w3.org/TR/xhtml-m12n-schema/
There you find

<xs:complexType name="body.type" mixed="true">
<xs:group ref="Block.mix" minOccurs="1" maxOccurs="unbounded"/>
<xs:attributeGroup ref="body.attlist"/>
</xs:complexType>

<xs:element name="body" type="body.type"/>

and then

<xs:group name="Block.mix">
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="Heading.class"/>
<xs:group ref="List.class"/>
<xs:group ref="Block.class"/>
<xs:group ref="Misc.class"/>
</xs:choice>
</xs:group>
--

Martin Honnen
http://JavaScript.FAQTs.com/

 
Reply With Quote
 
 
 
 
Moth
Guest
Posts: n/a
 
      08-05-2003
Martin Honnen wrote:

> <h> is not a defined XHTML 1.0 tag but I assume you want <h1> there.


It is XHTML2!

> <xs:complexType name="body.type" mixed="true">
> <xs:group ref="Block.mix" minOccurs="1" maxOccurs="unbounded"/>
> <xs:attributeGroup ref="body.attlist"/>
> </xs:complexType>
>
> <xs:element name="body" type="body.type"/>
>
> and then
>
> <xs:group name="Block.mix">
> <xs:choice minOccurs="0" maxOccurs="unbounded">
> <xs:group ref="Heading.class"/>
> <xs:group ref="List.class"/>
> <xs:group ref="Block.class"/>
> <xs:group ref="Misc.class"/>
> </xs:choice>
> </xs:group>


Thanks alot, this looks very promising!

--
Moth
 
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
complexType in Xml Schema Peter Theill XML 2 11-25-2004 08:22 PM
XSD Schema: complexType or Group? unishippers.suckfeed.newshosting.com XML 2 11-05-2004 05:57 PM
xml schema complextype indicator tsolbjor XML 0 07-19-2004 01:17 PM
complexType is not allowed here!? D. Alvarado XML 2 04-21-2004 12:50 PM
XML-Schema: How can I use a complexType without a certain order of elements? Wolfgang XML 2 10-07-2003 07:50 AM



Advertisments