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

Mukul Gandhi commented on XERCESJ-1569:
---------------------------------------

I'm reporting my analysis below, by using Xerces XSD 1.1 validator from the SVN.

I get following validation errors when I use your example as it is,

[Warning] x1.xsd:10:100: cvc-xpath.3.13.4.2b: An assert XPath expression such 
as ('/root = 'present'') containing / or //, on the schema type 
'#AnonType_root', cannot yield a valid result (since an assert tree is rooted 
at a parentless element).
[Error] x1.xml:3:76: cvc-assertions-valid: Value '' is not facet-valid with 
respect to assertion '/root = 'present''.
[Error] x1.xml:3:76: cvc-assertion: Assertion evaluation ('/root = 'present'') 
for element 'root' on schema type '#AnonType_root' did not succeed.

I believe, this is the intention of our implementation for the example you've 
posted.

If I change the assertion in your example to,

<xs:assertion test="$value = 'present'" 
xpathDefaultNamespace="##targetNamespace" />

(or to, <xs:assertion test="$value = 'present'"/>)

and XML instance document to,

<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">present</root>

I get a right schema validation assessment. This seems correct to me.

Are you using the Xerces XSD 1.1 build from SVN, or the Xerces schema 1.1 beta 
release? I think, the SVN code base would have improvements not present in the 
published schema 1.1 beta release.
                
> NPE when validating XML with XML Schema 1.1 (but validation is made in 1.0 
> compatibility mode)
> ----------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1569
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1569
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>            Reporter: Radu Coravu
>             Fix For: 2.11.0
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> 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)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to