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

Re: a simple question about ComplexContent schema element

From: Navid <silencer2020@yahoo.ca>
Date: Fri, 18 Apr 2003 11:25:27 -0400 (EDT)
Message-ID: <20030418152527.63836.qmail@web41703.mail.yahoo.com>
To: Paul Kiel <paul@hr-xml.org>, mrana@atiam-tech.com, xmlschema-dev@w3.org

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

The other problem with the above schema is that it
uses 'complexContent' but specifies the 'string'
simple type.

'complexContent' is used to derive a complex type from
another *complex type*.  'string' is a simple type.

Navid.


 --- Paul Kiel <paul@hr-xml.org> wrote: > 
> 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
> >
> >
> >
>  

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca
Received on Friday, 18 April 2003 11:25:33 GMT

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