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

NullPointerException when parsing an XML Schema 1.1 that contains openContent

    XMLWordPrintableJSON

Details

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

    Description

      When I parse the following schema I get a NullPointerException. The open content element from the schema does not have an wildcard set yet. So, Xerces presents correctly the error about the open content but then it gets a NullPointerException.
      I tested on the xml-schema-1.1-dev branch.

      ------------Schema----------------------------
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
      <xs:defaultOpenContent mode="interleave">
      <xs:any namespace="##targetNamespace"/>
      </xs:defaultOpenContent>
      <xs:complexType name="mainCT">
      <xs:all>
      <xs:element name="elemA" type="mainCT"/>
      </xs:all>
      </xs:complexType>
      <xs:complexType name="bCT">
      <xs:complexContent>
      <xs:extension base="mainCT">
      <xs:openContent mode="interleave">
      </xs:openContent>
      <xs:all>
      <xs:element name="elemB"/>
      </xs:all>
      </xs:extension>
      </xs:complexContent>
      </xs:complexType>
      </xs:schema>
      ------------------------------------------------------

      -------------------- NPE----------------------------
      Exception in thread "main" java.lang.NullPointerException
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexContent(XSDComplexTypeTraverser.java:1304)
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:455)
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseGlobal(XSDComplexTypeTraverser.java:208)
      at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1649)
      at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:728)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
      at org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
      at XercesValidation.main(XercesValidation.java:256)

      Attachments

        Activity

          People

            mukul_gandhi Mukul Gandhi
            octavian.nadolu Octavian Nadolu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: