You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2012/09/24 13:02:07 UTC
[jira] [Assigned] (XERCESJ-1589) NullPointerException when parsing
an instance that has a XSD 1.0 schema with 'defaultOpenContent' element
[ https://issues.apache.org/jira/browse/XERCESJ-1589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich reassigned XERCESJ-1589:
---------------------------------------------
Assignee: Michael Glavassevich
> NullPointerException when parsing an instance that has a XSD 1.0 schema with 'defaultOpenContent' element
> ---------------------------------------------------------------------------------------------------------
>
> Key: XERCESJ-1589
> URL: https://issues.apache.org/jira/browse/XERCESJ-1589
> Project: Xerces2-J
> Issue Type: Bug
> Components: XML Schema 1.0 Structures, XML Schema 1.1 Structures
> Affects Versions: 2.11.0
> Reporter: Octavian Nadolu
> Assignee: Michael Glavassevich
>
> 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-------------------
> <root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schema.xsd"/>
> -------------------------------------------------------
> ---------------------schema.xsd-----------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
> <xs:defaultOpenContent mode="suffix">
> <xs:any/>
> </xs:defaultOpenContent>
>
> <xs:element name="root"/>
> </xs:schema>
> --------------------------------------------------------
> -----------NullPointerException -------------------------------
> Exception in thread "main" java.lang.NullPointerException
> at org.apache.xerces.impl.xs.traversers.XSDComplexTypeTraverser.traverseOpenContent(XSDComplexTypeTraverser.java:268)
> at org.apache.xerces.impl.xs.traversers.XSDHandler.buildGlobalNameRegistries(XSDHandler.java:1481)
> at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:716)
> at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:3074)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2259)
> at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:880)
> at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:275)
> 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)
> ---------------------------------------------------------------------------
> It seems that in the XSDHandlerXerces.buildGlobalNameRegistries(), the method XSDComplexTypeTraverser.traverseOpenContent(Element, XSDocumentInfo, SchemaGrammar, boolean) is called even if the current schema version is 1.0. For 1.0 this method should not be called.
> Also the XSAttributeCheckerXerces.checkAttributes(Element, boolean, XSDocumentInfo, boolean) method can return null in some cases, maybe you should check that the attributes array is not null before using it.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org