Schema: complexType restrictions

Discussion in 'XML' started by Moth, Aug 2, 2003.

  1. Moth

    Moth Guest

    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
     
    Moth, Aug 2, 2003
    #1
    1. Advertising

  2. 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/
     
    Martin Honnen, Aug 3, 2003
    #2
    1. Advertising

  3. Moth

    Moth Guest

    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
     
    Moth, Aug 5, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang
    Replies:
    2
    Views:
    739
    Wolfgang
    Oct 7, 2003
  2. tsolbjor
    Replies:
    0
    Views:
    500
    tsolbjor
    Jul 19, 2004
  3. unishippers.suckfeed.newshosting.com

    XSD Schema: complexType or Group?

    unishippers.suckfeed.newshosting.com, Nov 4, 2004, in forum: XML
    Replies:
    2
    Views:
    403
    unishippers.suckfeed.newshosting.com
    Nov 5, 2004
  4. Peter Theill

    complexType in Xml Schema

    Peter Theill, Nov 25, 2004, in forum: XML
    Replies:
    2
    Views:
    469
    Peter Theill
    Nov 25, 2004
  5. Nicolas Mailhot

    Element + complextype name in xml schema

    Nicolas Mailhot, Apr 8, 2005, in forum: XML
    Replies:
    4
    Views:
    555
    Nicolas Mailhot
    Apr 11, 2005
Loading...

Share This Page