XML Schema Validation Error Report
Herong Yang <[email protected]> Thu, 18 Jun 2020 06:58:51 +0000 (UTC)
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <[email protected]> |
------=_Part_20756_1574248961.1592463531514
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hi,=C2=A0
By default, Xerces2 only reports only the first invalid sub-element and ski=
ps other subsequent invalid siblings. Is the any way to set Xerces2 to repo=
rt all invalid sub-elements?
Here is the sample XML:=C2=A0<?xml version=3D"1.0"?><root> <X/> <A/> <Y/> <=
B/></root>
Here is the XML Schema:=C2=A0<?xml version=3D"1.0"?><xs:schema xmlns:xs=3D"=
http://www.w3.org/2001/XMLSchema">=C2=A0 <xs:element name=3D"root"> <xs:com=
plexType> <xs:all> <xs:element name=3D"X" minOccurs=3D"0"/> <xs:element nam=
e=3D"Y" minOccurs=3D"0"/> </xs:all> </xs:complexType> </xs:element></xs:sch=
ema>
Here is the Xerces2 validation output:=C2=A0[Error] simple_4.xml:4:6: cvc-c=
omplex-type.2.4.a: Invalid content was found starting with element 'A'. One=
of '{Y}' is expected.
I want to see both element 'A' and element 'B' being reported in the output=
.=C2=A0
Thanks.=C2=A0
Herong
------=_Part_20756_1574248961.1592463531514
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><head></head><body><div class=3D"ydpfdbfffa7yahoo-style-wrap" style=
=3D"font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px=
;"><div dir=3D"ltr" data-setdir=3D"false">Hi, </div><div dir=3D"ltr" d=
ata-setdir=3D"false"><br></div><div dir=3D"ltr" data-setdir=3D"false">By de=
fault, Xerces2 only reports only the first invalid sub-element and skips ot=
her subsequent invalid siblings. Is the any way to set Xerces2 to report al=
l invalid sub-elements?</div><div dir=3D"ltr" data-setdir=3D"false"><br></d=
iv><div dir=3D"ltr" data-setdir=3D"false">Here is the sample XML: </di=
v><div dir=3D"ltr" data-setdir=3D"false"><div><div><?xml version=3D"1.0"=
?></div><div><root></div><div><span class=3D"ydp21841afApple-tab-s=
pan" style=3D"white-space: pre-wrap;">=09</span><X/></div><div><span =
class=3D"ydp21841afApple-tab-span" style=3D"white-space: pre-wrap;">=09</sp=
an><A/></div><div><span class=3D"ydp21841afApple-tab-span" style=3D"w=
hite-space: pre-wrap;">=09</span><Y/></div><div><span class=3D"ydp218=
41afApple-tab-span" style=3D"white-space: pre-wrap;">=09</span><B/></=
div><div></root></div><div dir=3D"ltr" data-setdir=3D"false"><br></di=
v></div><div dir=3D"ltr" data-setdir=3D"false">Here is the XML Schema: =
;</div><div dir=3D"ltr" data-setdir=3D"false"><div><div><?xml version=3D=
"1.0"?></div><div><xs:schema xmlns:xs=3D"http://www.w3.org/2001/XMLSc=
hema"> </div><div><span class=3D"ydp45012caApple-tab-span" style=3D=
"white-space: pre-wrap;">=09</span><xs:element name=3D"root"></div><d=
iv><span class=3D"ydp45012caApple-tab-span" style=3D"white-space: pre-wrap;=
">=09=09</span><xs:complexType></div><div><span class=3D"ydp45012caAp=
ple-tab-span" style=3D"white-space: pre-wrap;">=09=09=09</span><xs:all&g=
t;</div><div><span class=3D"ydp45012caApple-tab-span" style=3D"white-space:=
pre-wrap;">=09=09=09=09</span><xs:element name=3D"X" minOccurs=3D"0"/&g=
t;</div><div><span class=3D"ydp45012caApple-tab-span" style=3D"white-space:=
pre-wrap;">=09=09=09=09</span><xs:element name=3D"Y" minOccurs=3D"0"/&g=
t;</div><div><span class=3D"ydp45012caApple-tab-span" style=3D"white-space:=
pre-wrap;">=09=09=09</span></xs:all></div><div><span class=3D"ydp450=
12caApple-tab-span" style=3D"white-space: pre-wrap;">=09=09</span></xs:c=
omplexType></div><div><span class=3D"ydp45012caApple-tab-span" style=3D"=
white-space: pre-wrap;">=09</span></xs:element></div><div dir=3D"ltr"=
data-setdir=3D"false"></xs:schema></div></div></div></div><div dir=
=3D"ltr" data-setdir=3D"false"><br></div><div dir=3D"ltr" data-setdir=3D"fa=
lse">Here is the Xerces2 validation output: </div><div dir=3D"ltr" dat=
a-setdir=3D"false"><span><div>[Error] simple_4.xml:4:6: cvc-complex-type.2.=
4.a: Invalid content was found starting with element 'A'. One of '{Y}' is e=
xpected.</div><div><br></div><div dir=3D"ltr" data-setdir=3D"false">I want =
to see both element 'A' and element 'B' being reported in the output. =
</div><div dir=3D"ltr" data-setdir=3D"false"><br></div><div dir=3D"ltr" dat=
a-setdir=3D"false">Thanks. </div></span></div><div dir=3D"ltr" data-se=
tdir=3D"false"><br></div><div dir=3D"ltr" data-setdir=3D"false"><br></div><=
div>Herong</div></div></body></html>
------=_Part_20756_1574248961.1592463531514--