W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > October to December 2009

[Bug 7813] New: defaultOpenContent should not prevent inheriting openContent when using extension

From: <bugzilla@wiggum.w3.org>
Date: Mon, 05 Oct 2009 19:11:34 +0000
To: www-xml-schema-comments@w3.org
Message-ID: <bug-7813-703@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=7813

           Summary: defaultOpenContent should not prevent inheriting
                    openContent when using  extension
           Product: XML Schema
           Version: 1.1 only
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Structures: XSD Part 1
        AssignedTo: David_E3@VERIFONE.com
        ReportedBy: kbraun@obj-sys.com
         QAContact: www-xml-schema-comments@w3.org
                CC: cmsmcq@blackmesatech.com


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


-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Monday, 5 October 2009 19:11:38 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:13:17 GMT