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

NullPointerException when parsing an instance that has a XSD 1.0 schema with 'inheritable' attribute

    XMLWordPrintableJSON

Details

    Description

      If I parse the instance.xml file using the following java code, I get an NullPointerException. I tested on the xml-schema-1.1-dev branch.

      ----------Java code----------------------
      XMLReader parser = new org.apache.xerces.parsers.SAXParser();
      parser.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE, true);
      parser.parse("file:/C:/instance.xml");
      --------------------------------------

      ----------------instance.xml------------------
      <BookStore xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd">
      </BookStore>
      -------------------------------------------------------

      --------------------schema.xsd----------------
      <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
      <xs:element name="BookStore">
      <xs:complexType>
      <xs:attribute name="lang" inheritable="true" type="xs:string"/>
      </xs:complexType>
      </xs:element>
      </xs:schema>
      --------------------------------------------------------

      -----------NullPointerException -------------------------------
      Exception in thread "main" java.lang.NullPointerException
      at org.apache.xerces.impl.xs.traversers.XSDAttributeTraverser.traverseLocal(XSDAttributeTraverser.java:144)
      at org.apache.xerces.impl.xs.traversers.XSDAbstractTraverser.traverseAttrsAndAttrGrps(XSDAbstractTraverser.java:796)
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.processComplexContent(XSDComplexTypeTraverser.java:1639)
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseComplexTypeDecl(XSDComplexTypeTraverser.java:485)
      at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseLocal(XSDComplexTypeTraverser.java:181)
      at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:393)
      at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:241)
      at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1629)
      at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:724)
      at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:3072)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2259)
      at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:859)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:733)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1754)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
      at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:890)
      at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:813)
      at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1129)
      at XercesParse.main(XercesParse.java:70)
      ---------------------------------------------------------------------------

      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:
              Resolved: