- From: Gerson Mizuta Weiss <weiss@cpqd.com.br>
- Date: Fri, 4 Jan 2002 10:22:59 -0500 (EST)
- To: <xmlschema-dev@w3.org>
Hi,
I would like to know if it is possible to extend a xsd type (like xs:string) without having to define global SimpleTypes. For example, I have to define many string type attributes, but all of them have different lenghts.
Ex:
There are many attributes:
<xs:attribute name = "value1" type="xs:string" use="required"/> <!-- where the max length is 30
<xs:attribute name = "value2" type= "xs:string" use="required"/> <!-- where the max length is 20
...
<xs:attribute name = "value3" type= "xs:string" use="required"/> <!-- where the max length is 11
To specify diferent lengths I can define new simpletypes, and put them as the types of the attributes:
<xs:simpleType name="string30">
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="string11">
<xs:restriction base="xs:string">
<xs:maxLength value="11"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="string20">
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name = "value1" type="string30" use="required"/>
<xs:attribute name = "value2" type= "string20" use="required"/>
...
<xs:attribute name = "value3" type= "string11" use="required"/>
I want to know is is there a way to do something like that:
(Note that this way the following schema error is throwed: Anonymous complexType: Invalid child
among the children of the complexType definition. )
<xs:attribute name = "value1" use="required"/>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="30"/>
</xs:restriction>
</xs:simpleType>
<xs:attribute name = "value2" use="required"/>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="20"/>
</xs:restriction>
</xs:simpleType>
...
Thanks,
Gerson
Received on Sunday, 6 January 2002 15:37:47 UTC