Hi,

We think we have discovered an anomaly in Xerces' interpretation of the
XML schema structures specification.

Clause 1.4.3.2.2.1 of http://www.w3.org/TR/xmlschema-1/#cos-ct-extends
specifies that when deriving a new complex type by extension from an
existing complex type, then: "Both {content type}
<http://www.w3.org/TR/xmlschema-1/#content_type>s must be /mixed/ or
both must be /element-only/".

As demonstrated by the following schema, Xerces-J does not raise an
error despite the extension of a mixed complex type by a non-mixed one
being illegal. Note that no error is raised regardless of whether the
extension type explicitly sets mixed=false or relies on the default
value of the mixed attribute (false).

<?xml version="1.0" encoding="UTF-8"?>
<schema elementFormDefault='qualified'
targetNamespace='http://www.example.com/test/'
xmlns='http://www.w3.org/2001/XMLSchema'
xmlns:eg='http://www.example.com/test/'>
  <complexType name='mixedType' mixed='true'>
    <sequence>
      <any processContents='skip' minOccurs='0' maxOccurs='unbounded'
namespace='http://www.w3.org/1999/xhtml' />
    </sequence>
  </complexType>
<!-- This extension violates clause 1.4.3.2.2.1 of
http://www.w3.org/TR/xmlschema-1/#cos-ct-extends
     Xerces-J does not raise any errors or warnings when processing this
file with full schema checking
     This is still the case even with mixed=false explicitly set on the
complexType below and/or the complexContent
     Note that the inverse problem applies: move mixed=true from the
type above onto this one, and Xerces-J fails to complain
     (this case is also forbidden) -->
  <complexType name='extensionType'>
    <complexContent>
      <extension base='eg:mixedType'>
        <attribute use='required' ref='xml:lang' />
      </extension>
    </complexContent>
  </complexType>
</schema>

Is this intentional behaviour? Eclipse XSD appears to behave
identically, but we are led to believe that other tools regard such
schemas as invalid.

We are using xerces-j version 2.9.1

Thanks,

-- 
David North, Software Developer, CoreFiling Limited
http://www.corefiling.com
Phone: +44-1865-203192

Reply via email to