Uploaded image for project: 'Xerces2-J'
  1. Xerces2-J
  2. XERCESJ-1584

Warning should be issued when redefining complex type which is not directly in the redefined schema

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.11.0
    • 2.12.0
    • None

    Description

      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.

      Attachments

        Activity

          People

            mukul_gandhi Mukul Gandhi
            radu_coravu Radu Coravu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 3h
                3h
                Remaining:
                Remaining Estimate - 3h
                3h
                Logged:
                Time Spent - Not Specified
                Not Specified