Re: Re: Possible Bug: Xerces 2.12.1 for XML Validation with XSD 1.1 Schema under Java - Plain Text
Mukul Gandhi <[email protected]> Sun, 30 Aug 2020 17:14:20 +0530
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <CABuuzNM=YjVfWajaxb_s1Sjs1q3orERxk2Nfe3q99bfLb7RAwQ@mail.gmail.com> |
--000000000000254e7805ae16cf65
Content-Type: text/plain; charset="UTF-8"
I just played around, with this kind of XSD validation, but using somewhat
simple XSD and XML input documents. Below are mentioned my XSD and XML
input documents,
XSD document,
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="X">
<xs:complexType>
<xs:sequence>
<xs:element name="fileName" type="FileName"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="FileName">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="att1" type="xs:string"/>
<xs:assert test="if (./text()[matches(., 'a[0-9]')]) then
@att1 else true()"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:schema>
XML input document (which is found as valid with above mentioned schema
document),
<?xml version="1.0"?>
<X>
<fileName>a</fileName>
<fileName>b</fileName>
<!-- comment ... -->
<fileName att1="az">a0</fileName>
<!-- comment ... -->
<fileName>c</fileName>
<fileName att1="az">a5</fileName>
</X>
When I remove comments from above mentioned XML input document, I still see
the XML input document as valid.
The following XML input documents are found as invalid,
<?xml version="1.0"?>
<X>
<fileName>a</fileName>
<fileName>b</fileName>
<!-- comment ... -->
<fileName>a0</fileName>
<!-- comment ... -->
<fileName>c</fileName>
<fileName att1="az">a5</fileName>
</X>
<?xml version="1.0"?>
<X>
<fileName>a</fileName>
<fileName>b</fileName>
<!-- comment ... -->
<fileName>a0</fileName>
<!-- comment ... -->
<fileName>c</fileName>
<fileName>a5</fileName>
</X>
Therefore, fundamentally I don't see a bug with Xerces-J with the kind of
XSD and XML input documents discussed within this thread & the Jira issue
(those that are provided by John).
--
Regards,
Mukul Gandhi
--000000000000254e7805ae16cf65
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di=
r=3D"ltr"><div class=3D"gmail_quote"><div>I just played around, with this k=
ind of XSD validation, but using somewhat simple XSD and XML input document=
s. Below are mentioned my XSD and XML input documents,</div><div><br></div>=
<div>XSD document,</div><div><br></div><div><div><?xml version=3D"1=
.0"?></div><div><xs:schema xmlns:xs=3D"<a href=3D"http://ww=
w.w3.org/2001/XMLSchema">http://www.w3.org/2001/XMLSchema</a>"</div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 el=
ementFormDefault=3D"qualified"></div><div>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0</div><div>=C2=A0 =C2=A0 <xs:element name=3D"X=
"></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:complexType></div=
><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:sequence></div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:element nam=
e=3D"fileName" type=3D"FileName" maxOccurs=3D"unbo=
unded"/></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</xs=
:sequence></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0</xs:complexType><=
/div><div>=C2=A0 =C2=A0 </xs:element></div><div>=C2=A0 =C2=A0=C2=A0</=
div><div>=C2=A0 =C2=A0 <xs:complexType name=3D"FileName"></=
div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:simpleContent></div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <xs:extension base=3D"xs:string&quo=
t;></div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:att=
ribute name=3D"att1" type=3D"xs:string"/></div><div>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<xs:assert test=3D"=
if (./text()[matches(., 'a[0-9]')]) then @att1 else true()"/&g=
t;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </xs:extension></div>=
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0</xs:simpleContent></div><div>=C2=A0 =
=C2=A0 </xs:complexType></div><div>=C2=A0 =C2=A0=C2=A0</div><div><=
/xs:schema></div><div><br></div><div>XML input document (which is found =
as valid with above mentioned schema document),</div><div><br></div><div>&l=
t;?xml version=3D"1.0"?></div><div><X></div><div>=C2=A0 =
<fileName>a</fileName></div><div>=C2=A0 <fileName>b</f=
ileName></div><div>=C2=A0 <!-- comment ... --></div><div>=C2=A0 &l=
t;fileName att1=3D"az">a0</fileName></div><div>=C2=A0 &l=
t;!-- comment ... --></div><div>=C2=A0 <fileName>c</fileName>=
;</div><div>=C2=A0 <fileName att1=3D"az">a5</fileName>=
;</div><div></X></div><div><br></div><div>When I remove comments from=
above=C2=A0mentioned XML input document, I still see the XML input documen=
t as valid.</div><div><br></div><div>The following XML input documents are =
found as invalid,</div><div><br></div><div><div><?xml version=3D"1.=
0"?></div><div><X></div><div>=C2=A0 <fileName>a</fil=
eName></div><div>=C2=A0 <fileName>b</fileName></div><div>=C2=
=A0 <!-- comment ... --></div><div>=C2=A0 <fileName>a0</file=
Name></div><div>=C2=A0 <!-- comment ... --></div><div>=C2=A0 <f=
ileName>c</fileName></div><div>=C2=A0 <fileName att1=3D"az=
">a5</fileName></div><div></X></div></div><div><br></di=
v><div><div><?xml version=3D"1.0"?></div><div><X></di=
v><div>=C2=A0 <fileName>a</fileName></div><div>=C2=A0 <fileN=
ame>b</fileName></div><div>=C2=A0 <!-- comment ... --></div>=
<div>=C2=A0 <fileName>a0</fileName></div><div>=C2=A0 <!-- co=
mment ... --></div><div>=C2=A0 <fileName>c</fileName></div><=
div>=C2=A0 <fileName>a5</fileName></div><div></X></div></=
div></div><div><br></div><div>Therefore, fundamentally I don't see a bu=
g with Xerces-J with the kind of XSD and XML input documents discussed with=
in this thread & the Jira issue (those that are provided by John).</div=
><div><br></div><div>=C2=A0</div></div><div><br></div>-- <br><div dir=3D"lt=
r" class=3D"gmail_signature"><div dir=3D"ltr"><div>Regards,<br>Mukul Gandhi=
<br></div></div></div></div></div></div></div></div>
--000000000000254e7805ae16cf65--