Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: complexContent extending complexType with simpleContent: why not?

From: Sandy Gao <sandygao@--.---.--->
To: Joe Pallas <pallas@--.--------.--->
Date: 2/3/2006 4:53:00 AM
> Now, it is certainly the case that ExtendedType's content is actually 
> simple, not complex, ...

If you look at the mapping rules for complex types [1] ({content type} for 
<complexContent> with <extension>), it's clear that the {content type} of 
"ExtendedType" is element-only and a particle (clause 3.2.3).

> I looked at the complex type derivation constraints in the spec, and 
> I couldn't find a violation.

Look at constraint "Derivation Valid (Extension)" [2], clause 1.4. This 
clearly rules out the case where the base's {content type} is a simple 
type definition (in your case "string") and the derived (extended) type 
has {content type} element-only.

[1] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#declare-type
[2] http://www.w3.org/TR/2004/REC-xmlschema-1-20041028/#cos-ct-extends

Thanks,
Sandy Gao
XML Parser Development, IBM Canada
(1-905) 413-3255
sandygao@c...


xmlschema-dev-request@w... wrote on 02/02/2006 04:35:39 PM:

> 
> I got handed a schema that contains (stripped down to the bare 
> essentials) this:
> 
> <schema targetNamespace="http://example.com/myExample" 
> xmlns:tns="http://example.com/myExample" xmlns="http://www.w3.org/ 
> 2001/XMLSchema" elementFormDefault="qualified" 
> attributeFormDefault="unqualified">
> 
>    <complexType name="BaseType" abstract="true">
>       <simpleContent>
>          <extension base="string">
>             <attribute name="myAttr" use="optional"/>
>          </extension>
>       </simpleContent>
>    </complexType>
> 
>    <complexType name="DerivedType">
>       <simpleContent>
>          <extension base="tns:BaseType"/>
>       </simpleContent>
>    </complexType>
> 
>    <complexType name="ExtendedType">
>       <complexContent>
>          <extension base="tns:DerivedType">
>             <attribute name="anotherAttr" type="boolean" 
use="optional"/>
>          </extension>
>       </complexContent>
>    </complexType>
> 
> </schema>
> 
> XSV complains about ExtendedType, saying: attempt to derive a complex 
> basetype from a simple base: DerivedType.
> 
> Now, it is certainly the case that ExtendedType's content is actually 
> simple, not complex, so simpleContent would be more appropriate.  But 
> I can't figure out where in the rec it actually says that this is not 
> legal.
> 
> I found a discussion of what seems to be exactly this issue in the 
> archives.  The last word in that discussion was <http://lists.w3.org/ 
> Archives/Public/xmlschema-dev/2002Aug/0059.html>, which said "I think 
> you're right that this is legal."
> 
> I looked at the complex type derivation constraints in the spec, and 
> I couldn't find a violation.  So, this may be bad style, but why is 
> it rejected?
> 
> Thanks.
> joe
> 
> 
> 


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent