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

NPE when validating XML with XML Schema 1.1 (but validation is made in 1.0 compatibility mode)

    XMLWordPrintableJSON

Details

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

    Description

      I validate an XML:

      <root xmlns="http://xstest-tns/schema11_D4_3_15"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://xstest-tns/schema11_D4_3_15 npeXerces.xsd"/>

      with an XML Schema 1.1:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      xmlns:tns="http://xstest-tns/schema11_D4_3_15"
      targetNamespace="http://xstest-tns/schema11_D4_3_15"
      elementFormDefault="qualified">
      <xs:element name="root">
      <xs:simpleType>
      <xs:restriction base="xs:string">
      <xs:assertion test="/root = 'present'" xpathDefaultNamespace="##targetNamespace" />
      </xs:restriction>
      </xs:simpleType>
      </xs:element>
      </xs:schema>

      Although the schema is 1.1, it is parsed in 1.0-mode.

      The NPE is like:

      java.lang.NullPointerException
      at org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseFacets(XSDAbstractTraverser.java:468)
      at org.apache.xerces.impl.xs.traversers.XSDSimpleTypeTraverser.getSimpleType(Unknown Source)
      at org.apache.xerces.impl.xs.traversers.XSDSimpleTypeTraverser.traverseLocal(Unknown Source)
      at org.apache.xerces.impl.xs.traversers.XSDElementTraverserXerces.traverseNamedElement(XSDElementTraverserXerces.java:397)
      at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:69)
      at org.apache.xerces.impl.xs.traversers.XSDElementTraverserXerces.traverseGlobal(XSDElementTraverserXerces.java:240)
      at org.apache.xerces.impl.xs.traversers.XSDHandlerXerces.traverseSchemas(XSDHandlerXerces.java:1557)
      at org.apache.xerces.impl.xs.traversers.XSDHandlerXerces.parseSchema(XSDHandlerXerces.java:694)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(Unknown Source)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(Unknown Source)
      at org.apache.xerces.parsers.XMLGrammarPreparserXerces.preparseGrammar(XMLGrammarPreparserXerces.java:210)

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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