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 "Mukul Gandhi (JIRA)" <xe...@xml.apache.org> on 2012/09/03 17:45:07 UTC

[jira] [Commented] (XERCESJ-1583) NullPointerException when parsing an instance that has a schema with inheritable attribute

    [ https://issues.apache.org/jira/browse/XERCESJ-1583?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13447324#comment-13447324 ] 

Mukul Gandhi commented on XERCESJ-1583:
---------------------------------------

If I understand correctly, Xerces currently doesn't expose XSD 1.1 validation other than via JAXP APIs. Therefore, any attempt to do XSD 1.1 validation with Xerces other than via JAXP (for e.g, as used in your example in this bug report) is currently not implemented and unsupported in Xerces.
                
> NullPointerException when parsing an instance that has a schema with inheritable attribute
> ------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1583
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1583
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>    Affects Versions: 2.11.0
>            Reporter: Octavian Nadolu
>
> 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)
> ---------------------------------------------------------------------------

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