Radu Coravu created XERCESJ-1584:
------------------------------------

             Summary: Warning should be issued when redefining complex type 
which is not directly in the redefined schema
                 Key: XERCESJ-1584
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1584
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Datatypes
    Affects Versions: 2.11.0
            Reporter: Radu Coravu


I have 3 schemas like:

1.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified" targetNamespace="tns">
    <xs:complexType name="ct"/>
</xs:schema>


2.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified" targetNamespace="tns">
    <xs:include schemaLocation="1.xsd"/>
</xs:schema>


3.xsd:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
elementFormDefault="qualified" targetNamespace="tns" xmlns="tns">
    <xs:redefine schemaLocation="2.xsd">
        <xs:complexType name="ct">
            <xs:complexContent>
                <xs:extension base="ct">
                    <xs:attribute name="attr" use="required"/>
                </xs:extension>
            </xs:complexContent>
        </xs:complexType>
    </xs:redefine>
    <xs:element name="el" type="ct"/>
</xs:schema>



When validating "3.xsd" Xerces reports it as valid.
When validating "3.xsd" Saxon 9 EE reports:

The redefined complex type was found, but not in the schema document referenced 
by the schemaLocation attribute of the containing <xs:redefine> element. This 
is not allowed by the XSD specification. However, Saxon does not currently 
enforce this rule.


There are two problems:

1) In Xerces 2.9.0 this construct used to work, the complex type "ct" was 
redefined. 

So if you had an XML instance like:

<el xmlns="tns"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="tns 
file:/C:/Users/radu_coravu/Desktop/testWarning/3.xsd"/>

Xerces 2.9.1 reported an error, that the attribute "attr" was absent.
Xerces 2.11.0 no longer reports any error.

2) If you want to keep the current behavior of ignoring completely the 
redefine, then you should at least report a problem when validating the "3.xsd" 
schema like Saxon EE does.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to