- From: <bugzilla@wiggum.w3.org>
- Date: Fri, 13 Apr 2007 15:16:07 +0000
- To: www-xml-schema-comments@w3.org
- CC:
http://www.w3.org/Bugs/Public/show_bug.cgi?id=4467
Summary: Context determined type for complex type with simple
content
Product: XML Schema
Version: 1.1 only
Platform: All
URL: http://lists.w3.org/Archives/Member/w3c-xml-schema-
wg/2007Apr/0010.html
OS/Version: All
Status: NEW
Keywords: unclassified
Severity: normal
Priority: P2
Component: Structures: XSD Part 1
AssignedTo: cmsmcq@w3.org
ReportedBy: sandygao@ca.ibm.com
QAContact: www-xml-schema-comments@w3.org
<xs:complexType name="B" mixed="true">
<xs:sequence>
<xs:element name="e" type="xs:int" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="R">
<xs:simpleContent>
<xs:restriction base="B">
<xs:simpleType>
<xs:restriction base="xs:string"/>
</xs:simpleType>
</xs:restriction>
</xs:simpleContent>
</xs:complexType>
The CDT for "e" in "B" is "xs:int". What's the CDT for "e" in "R".
Currently it's "absent". Question: should it also be "xs:int" (i.e.
inherit from "B")?
Some WG members, during the F2F, felt that it should inherit from "B".
This can be "fixed" by removing "or CTD's {content type} has simple
{variety}". This is where my Action item came from. We wanted to make sure
such change wouldn't have any negative impact.
Because one can not derive from a complex type with simple content and add
element children to it (i.e. go from simple content to complex content),
whether simple content use absent or inherit doesn't make any difference
in most cases. The only case it affects (that I can think of now) is the
following. Consider the above complex types and the following instance:
<p xsi:type="R">
<e>abc</e>
</p>
Obviously <p> is invalid, because "R" has simple content and doesn't allow
<e>. But what happens to <e>?
If "R" uses "absent" as CDT for <e>, then as a consequence <e> doesn't
have a governing type definition. It will be laxly assessed using
xs:anyType.
But if "R" inherits CDT from "B", then <e> has xs:int as its CDT and
governing type, and will be flagged invalid because its content "abc" is
not a valid int.
Which is the right behavior? (I'm leaning a little toward inherit. i.e.
make the change suggested by this action item.)
[1]
http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.html#key-cdt
[2] http://www.w3.org/XML/Group/2007/01/xml-schema-ftf-minutes#fripm.vm3
Received on Friday, 13 April 2007 15:16:13 UTC