W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2003

Re: a simple question about ComplexContent schema element

From: Paul Kiel <paul@hr-xml.org>
Date: Fri, 18 Apr 2003 09:18:47 -0400
Message-ID: <008201c305ad$0b96f730$6401a8c0@pkiel2>
To: <mrana@atiam-tech.com>, <xmlschema-dev@w3.org>

At first glance, it appears you are trying to restrict and extend in the
same step.  That can't be done.  You can do both, but they need to be in
separate steps.
Adding an attribute to a base of string is an extension, so you can't use
xsd:restriction in that step.

You can create a type that adds the attribute (extend), then create another
type that restricts the first type to minLength.  It will take two types to
do it.




----- Original Message -----
From: <mrana@atiam-tech.com>
To: <xmlschema-dev@w3.org>
Sent: Friday, April 18, 2003 7:57 AM
Subject: a simple question about ComplexContent schema element


>
> Hi All,
>   I want to do something similar to this example. Is it possible?
>
>   <xsd:complexType name="companyType">
> <xsd:complexContent>
> <xsd:restriction base="xsd:string">
> <xsd:minLength value="1"/>
> <xsd:attribute name="tbl" type="xsd:string" default="COMPANY"/>
> </xsd:restriction>
> </xsd:complexContent>
>   </xsd:complexType>
>
>   Basically, all I want to do is,
>     declare one complexType which should impose restrictions like
> (minLength, maxLength, pattern, enumeration etc..)
>     on basic Types AND should have one more attribute like "tbl" declared
> above.
>
>    PS :
>
>    1.  I want TO AVOID using following format, eventhough this is one more
> valid approach.
>       <xsd:simpleType name="subCompanyType">
> <xsd:restriction base="xsd:string">
> <xsd:minLength value="1"/>
> </xsd:restriction>
> </xsd:simpleType>
>
> <xsd:complexType name="companyType">
> <xsd:complexContent>
> <xsd:extension base="subCompanyType">
> <xsd:attribute name="tbl" type="xsd:string" default="COMPANY"/>
> </xsd:extension>
> </xsd:complexContent>
> </xsd:complexType>
>
>    2. I know that following works fine. (i.e. Declare ONLY attribute
inside
> restriction and not "minLength")
>   <xsd:complexType name="companyType">
> <xsd:complexContent>
> <xsd:restriction base="xsd:string">
> <xsd:attribute name="tbl" type="tblType" default="COMPANY"/>
> </xsd:restriction>
> </xsd:complexContent>
> </xsd:complexType>
>
> Any help will be truly appreciated.
>
> Thanks
>
> mehul
>
>
>
Received on Friday, 18 April 2003 09:14:46 GMT

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