[Home] [By Thread] [By Date] [Recent Entries]


Wong Chin Shin wrote:

>Ah, I think I found the answer, but would like to post it up for someone
>more knowledgeable to verify. Would this be correct:
>
><xs:element name="myelement">
>	<xs:complexType>
>		<xs:simpleContent>
>			<xs:extension base="xs:string">
>				<xs:attribute name="myattrib1"
>type="xs:string" />
>				<xs:attribute name="myattrib2"
>type="xs:string" />			</xs:extension>
>		</xs:simpleContent>
>	</xs:complexType>
></xs:element>
>  
>
Actually, you probably don't even need to specify that the element's 
content is xs:string.

If there is a chance that myelement will someday contain subelements, 
*don't* declare it
a string and simpleContent now. If there is a chance that someday you 
will want to refine
the schema further to enforce, say, that myelement has a maximum of 20 
characters, then *do*
declare it a string now.

Cheers
Rick Jelliffe

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member