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

a simple question about ComplexContent schema element

From: <mrana@atiam-tech.com>
Date: Fri, 18 Apr 2003 07:57:20 -0400
To: <xmlschema-dev@w3.org>
Message-ID: <BBEPJNKGLFJHKMKHFICGKECMCBAA.mrana@atiam-tech.com>

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 08:10:20 GMT

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