By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,199 Members | 1,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,199 IT Pros & Developers. It's quick & easy.

Schema: complexType restrictions

P: n/a
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
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


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/

Jul 20 '05 #2

P: n/a
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
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.