W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2002

RE: Sequence fixed attributes

From: Ashok Malhotra <ashokma@microsoft.com>
Date: Mon, 7 Jan 2002 14:10:38 -0800
Message-ID: <E5B814702B65CB4DA51644580E4853FB019EE71D@red-msg-12.redmond.corp.microsoft.com>
To: "Gerson Mizuta Weiss" <weiss@cpqd.com.br>, <xmlschema-dev@w3.org>
Try this...

<xs:attribute name = "value1" use="required">
		<xs:simpleType>
		       <xs:restriction base="xs:string">
		    		   <xs:maxLength value="30"/>
	    		 </xs:restriction>
		</xs:simpleType>
</xs:attribute>	

All the best, Ashok 
===========================================================
Ashok Malhotra              <mailto: ashokma@microsoft.com> 
Microsoft Corporation
 



-----Original Message-----
From: Gerson Mizuta Weiss [mailto:weiss@cpqd.com.br] 
Sent: Friday, January 04, 2002 7:23 AM
To: xmlschema-dev@w3.org
Subject: RES: Sequence fixed attributes



	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 Monday, 7 January 2002 17:11:10 GMT

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