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