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

While using xsd xs:key having 'ref' attribute, a java.lang.NullPointerException is emitted

    XMLWordPrintableJSON

Details

    Description

      XML Schema 1.1 has introduced the attribute 'ref' on xs:key, xs:unique and xs:keyref. While processing the following schema in XSD 1.0 mode with Xerces's XSD 1.1 processor, a java.lang.NullPointerException is emitted when the schema document is processed with Xerces sample jaxp.SourceValidator.

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

           <xs:element name="X">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="a" type="xs:integer" maxOccurs="unbounded"/>
                        <xs:element name="b" type="xs:integer"/>
                    </xs:sequence>
                </xs:complexType>
                <xs:key name="a_key">
                     <xs:selector xpath="a"/>
                     <xs:field xpath="."/>
                </xs:key>
             </xs:element>

             <xs:element name="Y">
                  <xs:complexType>
                      <xs:sequence>
                          <xs:element name="a" type="xs:integer" maxOccurs="unbounded"/>
                          <xs:element name="b" type="xs:integer"/>
                      </xs:sequence>
                  </xs:complexType>
                  <xs:key ref="a_key"/>
             </xs:element>

      </xs:schema>

      Attachments

        Activity

          People

            mukul_gandhi Mukul Gandhi
            mukul_gandhi Mukul Gandhi
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: