Possible Bug: Xerces 2.12.1 for XML Validation with XSD 1.1 Schema under Java - Plain Text

JOHN Morris <[email protected]> Tue, 18 Aug 2020 22:04:31 +0100 (BST)
Newsgroups gmane.text.xml.xerces-j.user
Message-ID <[email protected]>
Hi,

I am a relative newcomer to Xerces for XML Validation.

I have been trying to replicate the results of a tutorial that I found on t=
he Internet. with particular reference to XSD Schema 1.1 features, Over tim=
e, I have tried using Xerces 2.12.1, along with various JDK versions (7, 8,=
 13). Currently, I am using the validation capabilities of the jaxp.TypeInf=
oWriter program.

Recently, I have begun to look at the XSD 1.1 assert/assertion features wit=
h a longer XML file.

I have used two sample XML files:

1) The first has more than 200 elements, one following hard on the previous=
 one.

With this file, I find that there are particular line numbers that give tro=
uble in the validation process, although the XML content of those lines app=
ears to be legal and valid.

Moving the complete XML code from one of the troublesome lines to another p=
osition, makes the same code in its new postion pass the validation but now=
 another new error occurs with a new XML contruct, which now appears at the=
 troublesome line number.

2) The same XML file as in (1) but with XML comment lines introduced at eac=
h of the troublesome line numbers so that no validation is now required at =
those lines. It should be noted, however, that the troublesome lines from c=
ase (1) still appear, immediately after each of the new comment lines. The =
validation now passes completely.

I am currently assuming that this behaviour (i.e. the errors) is unexpected=
.

I can provide a ZIP file with these test cases. (I did try to send the e-ma=
il posting this incident to the mailing list, complete with the attachment,=
 but it did not post. Can someone tell me whether attachments are supported=
 on this mailing list)?

The a ZIP file comprises a directory, testX, with following contents:

java_xercesX.bat - the batch file to run the test cases

test.xsd - the XSD 1.1 Schema file

test1.xml - the first XML file, without the extra comment lines

test2.xml - the second XML file, with the extra comment lines

xml_diffs.out - the result of a comparison (with the "fc" program) of the c=
ontent of the two XML files

In order to be able to run these test cases, you would have to unzip the at=
tached file, go to the testX directory and update the paths in the few few =
lines of the file=C2=A0java_xercesX.bat to suit your system. Then, to run o=
ne test case, you would use:

java_xercesX=C2=A0=C2=A0jaxp.TypeInfoWriter test.xsd=C2=A0test1.xml=20

for example, to validate test1.xml. (This batch file currently uses JDK8).

Results of my validations of the two test files are provided in test1.out a=
nd test2.out, also in the testX directory.

I look forward to getting some feedback on this possible bug.

Please do not hesitate to ask questions or to point out anything foolish th=
at I have been doing.

Regards,

John MORRIS,
Abingdon, UK.