Restricting Lists

This should cover W3C XML Schema, Relax NG and DTD related problems.
ahundiak
Posts: 7
Joined: Wed Mar 23, 2005 8:50 pm

Restricting Lists

Post by ahundiak » Thu Jul 14, 2005 11:32 pm

I'm trying to restrict the type and number of elements in a list with some attributes.

The generic attribute list looks like this:

<xs:simpleType name="anySimpleList" >
<xs:list itemType="xs:string" />
</xs:simpleType>

<!-- base data type for simple lists with array attributes -->
<xs:complexType name="anyList" abstract="true">
<xs:simpleContent>
<xs:extension base="geometry_schema:anySimpleList" >
<xs:attribute name="ref" type="xs:IDREF" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>

Then I try to restrict with:
<xs:complexType name="Coordinates">
<xs:simpleContent>
<xs:restriction base="geometry_schema:anyList">
<xs:simpleType>
<xs:list itemType="xs:double"/>
</xs:simpleType>
<xs:minLength value="1"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>

And I get:
derivation-ok-restriction.5.2.2.1:
Error for type 'Coordinates'.
The simple content type of this type, 'null', is not a valid restriction of the simple content type of the base, 'anySimpleList'.
@see: http://www.w3.org/TR/xmlschema-1/#deriv ... estriction geom1.xsd AP227_PIPE_057010 line 49 July 14, 2005 3:41:53 PM

Any hint?

ahundiak
Posts: 7
Joined: Wed Mar 23, 2005 8:50 pm

Post by ahundiak » Thu Jul 14, 2005 11:38 pm

Sorry. Forgot to use BBcode and maybe I'm blind but I can't seem to find the edit post button.

Here is the list:

Code: Select all


    <xs:simpleType name="anySimpleList" >
<xs:list itemType="xs:string" />
</xs:simpleType>

<!-- base data type for simple lists with array attributes -->
<xs:complexType name="anyList" abstract="true">
<xs:simpleContent>
<xs:extension base="geometry_schema:anySimpleList" >
<xs:attribute name="ref" type="xs:IDREF" use="optional"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
Here is the restriction:

Code: Select all


    <xs:complexType name="Coordinates">
<xs:simpleContent>
<xs:restriction base="geometry_schema:anyList">
<xs:simpleType>
<xs:list itemType="xs:double"/>
</xs:simpleType>
<xs:minLength value="1"/>
<xs:maxLength value="3"/>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
[/code]

Post Reply