This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 7813 - defaultOpenContent should not prevent inheriting openContent when using extension
Summary: defaultOpenContent should not prevent inheriting openContent when using exte...
Status: CLOSED FIXED
Alias: None
Product: XML Schema
Classification: Unclassified
Component: Structures: XSD Part 1 (show other bugs)
Version: 1.1 only
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---
Assignee: David Ezell
QA Contact: XML Schema comments list
URL:
Whiteboard:
Keywords: resolved
Depends on:
Blocks:
 
Reported: 2009-10-05 19:11 UTC by Kevin Braun
Modified: 2009-11-30 16:43 UTC (History)
1 user (show)

See Also:


Attachments
Wording proposal B (adopted) (154.67 KB, text/html)
2009-11-30 01:31 UTC, C. M. Sperberg-McQueen
Details

Description Kevin Braun 2009-10-05 19:11:33 UTC
I posted to xmlschema-dev about this but didn't get any feedback, so I'm opening this.

Consider this schema:

<xs:schema ...>
    <xs:defaultOpenContent mode="interleave">
       <xs:any namespace="xyz:myURI">
    </xs:defaultOpenContent>
    ...
    <xs:complexType name="Base">
       <xs:openContent mode="interleave">
          <xs:any namespace="##any">
       </xs:openContent>
       <xs:sequence>
          <xs:element name="elemOne"/>
       </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Derived">
       <xs:complexContent>
          <xs:extension base="Base">
               <xs:sequence>
                   <xs:element name="elemTwo"/>
                </xs:sequence>
          </xs:extension>
       </xs:complexContent>
    </xs:complexType>
   
    ...

</xs:schema>

In Base, we use an open content that allows elements from any namespace, whereas the default the open content is more restrictive (only match xyz:myURI).  We extend Base to create Derived.  According to  Mapping Rules for Content Type Property of Complex Content (ยง3.4.2.3.3), Derived gets its {open content} from the schema default, allowing only xyz:myURI.  However, that violates 3.4.6.2 Derivation Valid (Extension) (point 1.4.3.2.2.4 - the namespace subset requirement).

When applying step 4.2.3 in the mapping rules to Derived, it looks like we're getting ready to inherit the {open content} from Base, but then we turn around in steps 5 and 6 and take the default open content, which leads to the above violation.  I find it hard to believe that this was the intended behavior.  I would have thought it most natural to inherit the open content from the base type.  

It may be that I am missing something, or that what I just described is really the intended behavior, but I am certainly surprised by it, and suspect users of XSD would be likewise surprised.  It isn't entirely unreasonable behavior, but I found it surprising enough that I wanted to pose this question to make sure an error wasn't made in the mapping.

Thanks,

-- 
Kevin Braun
Objective Systems, Inc.
http://www.obj-sys.com
Comment 1 David Ezell 2009-10-09 15:56:34 UTC
The WG agrees that this needs to be clarified (and possibly treated similarly to mixed content).  
Comment 2 C. M. Sperberg-McQueen 2009-10-28 17:57:41 UTC
Two wording proposals intended to address this issue are now at 

 http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.b7813.a.html
 http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.b7813.b.html

A third form of the proposals is at

 http://www.w3.org/XML/Group/2004/06/xmlschema-1/structures.b7813.html

marking proposal A as a normal change proposal and B as non-status-quo, to make
it possible to see both in the same document.
Comment 3 David Ezell 2009-11-13 17:03:21 UTC
The WG adopted the 'B' proposal.
Comment 4 C. M. Sperberg-McQueen 2009-11-30 01:31:40 UTC
Created attachment 784 [details]
Wording proposal B (adopted)

The change adopted by the Working Group has now been integrated into the status-quo documents on the server.  Accordingly, I'm marking the issue resolved.

I'm also attaching a copy of the change proposal adopted by the WG to this issue, so Kevin Braun (the originator of the issue) can see it.  It would be helpful if you were willing to examine the change made and confirm, by closing the issue, that you are satisfied with the disposition of this issue (or, if need be, to indicate that you are not satisfied, by reopening the issue).  If we don't hear from you in the next two weeks we will assume that you are content.  Thank you!
Comment 5 Kevin Braun 2009-11-30 16:43:34 UTC
I think the proposed solution fixes the problem I reported, and probably some others that I hadn't thought of.  Thanks.