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

xsd:simpletype or <xsd:complexType with simpleContent?

From: Dan Vint <dvint@dvint.com>
Date: Wed, 11 Jan 2006 16:34:01 -0800
Message-Id: <6.1.0.6.2.20060111162500.03735008@mail.dvint.com>
To: xmlschema-dev@w3.org

Can someone explain these two constructs and any advantage or disadvantage 
to using one over the other?

Too me it appears that at a schema level these are equivalent and possibly 
at the code generation level as well.

I am currently using the following design:

<xsd:complexType name="AboveGroundIndicator_Type">
   <xsd:simpleContent>
         <xsd:extension base="xsd:boolean"/>
    </xsd:simpleContent>
</xsd:complexType>

<xsd:element name="AboveGroundIndicator" type="AboveGroundIndicator_Type"/>

This seems to be the equivalent:

<xsd:simpleType name="AboveGroundIndicator_Type">
         <xsd:restriction base="xsd:boolean"/>
</xsd:simpleType>

<xsd:element name="AboveGroundIndicator" type="AboveGroundIndicator_Type"/>

I see that one seems to allow extension where the other limits me to 
restriction, but I believe even with the extension definition, I could not 
extend my Type by adding additional attributes.

..dan
---------------------------------------------------------------------------
Danny Vint

Specializing in Panoramic Images of California and the West
http://www.dvint.com

voice: 510-522-4703

When H.H. Bennett was asked why he preferred to be out
shooting landscapes rather than spending time in his portrait studio:

"It is easier to pose nature and less trouble to please."

http://www.portalwisconsin.org/bennett_feature.cfm

     
Received on Thursday, 12 January 2006 00:26:37 GMT

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