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

Wrong namespace binding used for resolving QName prefix in an XSD

    XMLWordPrintableJSON

Details

    Description

      If I validate the following XML Schema, Xerces reports an error saying that the element "m:elemInclude" is in namespace "someOtherNS". Which is wrong, because the "elemInclude" is in namespace "targetNS".
      This is because of the namespace declaration (xmlns:m="someOtherNS") added on the "elemInclude" element declaration, which maps the "m" prefix to the "someOtherNS" namespace. This namespace declaration overrides the namespece declaration from the schema element (xmlns:m="targetNS"), but this should not affect the namespace of the "elemInclude" element.
      I tested on the xml-schema-1.1-dev branch.

      ---- XML Schema -------------
      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema
      elementFormDefault="qualified"
      targetNamespace="targetNS" xmlns:m="targetNS"
      xmlns:xs="http://www.w3.org/2001/XMLSchema">

      <xs:element name="elemInclude" xmlns:m="someOtherNS">
      <xs:complexType>
      <xs:choice>
      <xs:element name="childInclude"/>
      </xs:choice>
      </xs:complexType>
      </xs:element>

      <xs:element name="root">
      <xs:complexType>
      <xs:sequence>
      <xs:element ref="m:elemInclude"/>
      </xs:sequence>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      -----------------------------------

      Attachments

        Activity

          People

            mrglavas@ca.ibm.com Michael Glavassevich
            octavian.nadolu Octavian Nadolu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: