W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2002

Re: another restriction question

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 24 Jul 2002 23:42:02 +0100
Message-ID: <61594646460.20020724234202@jenitennison.com>
To: Calvin Smith <calvins@SIMS.Berkeley.EDU>
CC: xmlschema-dev@w3.org

Hi Calvin,

> With the occurrence range of the wildcard now set to 0 - unbounded
> and the namespace constraint set to ##any, it seems that it
> satisfies all the requirements, but it still fails.

I've played around with this a bit and I can't find any way of making
Xerces-J validate an "allow anything" content model. I'm not sure
whether this is a bug or whether Xerces-J is following the letter of
XML Schema Rec. MSXML seems to object to the same kind of things
(which would indicate that it wasn't a bug), but then again they both
object to the schema for XML Schema, which we have to assume is
valid...

Anyway, what about building your hierarchy based on extension rather
than restriction. Make your PayloadType allow *nothing* and then
extend it to allow extra things:

<xsd:complexType name="PayloadType" abstract="true" />

<xsd:complexType name="LabelType">
  <xsd:complexContent>
    <xsd:extension base="PayloadType">
      <xsd:sequence maxOccurs="unbounded">
        <xsd:element name="LabelGraphic" type="cct:GraphicType"
                     minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element name="LabelURI" type="xsd:anyURI" minOccurs="0"
                     maxOccurs="unbounded"/>
        <xsd:element name="LabelHTML" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 24 July 2002 18:42:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:32 GMT