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

Mukul Gandhi commented on XERCESJ-1726:
---------------------------------------

With your latest XSD document test5.xsd, and the corresponding XML instance 
document, the validation with XercesJ sample jaxp.SourceValidator using option 
-vs dom works fine and I don't get any errors. As per jaxp.SourceValidator's 
documentation, '-vs source  Select validation source (sax|dom|stax|stream)' 
(the default value being sax).

So it seems to be, the validation source issue. You can also see the, 
jaxp.SourceValidator's source code, to see how to set validation source with 
XercesJ APIs or look for that within XercesJ documentation.

About the question, "I would like to ask you why this splitting of the text 
part is happening on just a few of the element lines in my XML instance file?", 
that needs to be debugged and tried to be solved if that's the problem (as I've 
found, the default validation source is having issues with your examples. You 
may use the 'dom' validation source for now).

The semantics of variable $value is defined within the XML Schema 1.1 spec 
(https://www.w3.org/TR/xmlschema11-1/, section 3.13.4.1 Assertion Satisfied 
point 2, and https://www.w3.org/TR/xmlschema11-2/ section 4.3.13.3 Assertions 
Validation Rules).

I think that, in the context of XSD 1.1 assertions, $value is more prominent 
(likely to be used) with xs:assertion facet for the simple types. For 
xs:assertion facet, the XPath expression contains a built-in variable $value 
(which the XSD validator makes available to the schema author) which has a 
value that's been validated from XML instance document. The variable $value is 
also available, within xs:assert for complexType with simpleContent with the 
same meaning, as written within preceding sentence.

> Possible Bug: Xerces 2.12.1 for XML Validation with XSD 1.1 Schema under Java
> -----------------------------------------------------------------------------
>
>                 Key: XERCESJ-1726
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1726
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Samples
>    Affects Versions: 2.12.1
>         Environment: Windows 7
> Java 1.8.0_261
> Xerces-J 2.12.1
>            Reporter: J Morris
>            Assignee: Mukul Gandhi
>            Priority: Major
>              Labels: test
>         Attachments: TestSecondError.zip, TestSimplified.zip, testX.zip, 
> test_cases_ mukul.zip
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> I have recently been trying to validate the XML file *test1.xml* with a 
> schema *test.xsd* containing *assert*/*assertion* constructs, using the 
> sample program *jaxp.SourceValidator*.
> Unexpectedly, the result was several reported errors in what appeared to be 
> syntactically correct and valid XML lines (*test1.xml*: 9 errors).
> After significant experimentation, it appeared that these errors were 
> occurring at line numbers which the validation found troublesome. Inserting 
> an extra line at one of the troublesome line numbers made the previously 
> erroneous line (now *not* appearing at a troublesome line number) pass 
> validation. On the other hand, the newly inserted line (occupying the 
> troublesome line number) would fail validation.
> I tentatively interpreted this as meaning that *the validation errors were 
> not real* and began to try to develop a test-case, as similar as possible to 
> *test1.xml*, but which passed validation. The result was *test2.xml*, which 
> was generated from *test1.xml* by inserting XML comment lines at each of the 
> troublesome line numbers, thereby displacing the previously erroneous lines 
> to non-trooublesome line numbers. Since XML comment lines do not require 
> validation, this file passed validation for me (*test2.xml*: 0 errors).
> I then contacted Mukul Gandhi and he re-ran my validations *but came to a 
> different result*. He saw errors in both XML files (*test1.xml*: 9 errors; 
> *test2.xml*: 18 errors). Despite our joint efforts to achieve convergence 
> between our respective validation runs, we have not so far succeeded.
> Mukul did point out a couple of things:
> 1) The way that I was using the "matches" function in the *assert* 
> constructs. His experience suggested that this was unreliable. However, I was 
> not certain whether this would have led to the type of behaviour that I was 
> seeing (apparent troublesome line numbers).
> 2) He found that certain characters (probably the two accented French 
> characters) in my XML files were not supported in the default XML encoding 
> scheme, UTF-8. However, for me, no errors were reported for those by the 
> validation program *jaxp.SourceValidator*.
> I would be very gratefull foe some help in getting to the bottom of this 
> (both the original behaviour and the discrepancies with Mukul's validation 
> runs).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-dev-h...@xerces.apache.org

Reply via email to