Re: another restriction question

Hi Jeni,

On Wed, 24 Jul 2002, Jeni Tennison wrote:

>
> 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>

Thanks again.  As always, you have been a great help.  I had thought about
using extension when I first ran into this problem, but I don't like that
the derived types will not be valid against the base type. Still, a
functioning extension is better than a non-functioning restriction, so I
will use extension for now.

cheers,

calvin

Received on Wednesday, 24 July 2002 19:07:29 UTC