Validating with external entities and schemas 1.4.4 vs 2.3.0 2003-02-21 - By Fitzharris, Walter M. (LNG-DAY)
For more on the same problem, see my unanswered emails in the archives... To save you some pain: Basically, schema does not address physical doc items like entities...they are like word-processor macros that live in the physical world, not the logical. Schema addresses the logical doc, so entities beyond the built-in must be pre-processed out by you before the parser ever sees the file. My guess is that the mutant "combo" document worked with old versions of the parser by pure luck. Unfortunately, the default parser in XML Spy also parses these Frankensteins without errors, giving you the illusion that you might be able to use such a thing in production.
Walt Fitzharris
-----Original Message----- From: Stottlemyer, Carl [mailto:carl.stottlemyer@(protected)] Sent: Friday, February 21, 2003 9:19 AM To: xerces-j-user@(protected) Subject: Validating with external entities and schemas 1.4.4 vs 2.3.0
I have a document with structure similar to the xml below. When I use Xerces 1.4.4, I am able to validate the document against the schema without any problems. When I use Xerces 2.3.0 the validation tells me that all of the elements in each of the entities need to be defined (however they are defined in the schema.) It appears to me that the xerces is searching the DTD for the ANY elements without referencing the schema. Any explanation as to why it works in 1.4.4 and not 2.3.0. I would also appreciate any recommendations as to what I need to do to make it work in 2.3.0.
Thanks, Carl
<?xml version="1.0" encoding="UTF-8" ?> <!-- leagues are validated against the league.xsd schema. The DOCTYPE is included to provide ENTITY references to embedded xml files --> <!DOCTYPE league[ <!ELEMENT league ANY> <!ENTITY team1 SYSTEM "someUrl"> <!ENTITY team2 SYSTEM "someUrl2">
]> <leauge xmlns=" http://www.myLeague.com <http://www.myLeague.com> " xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance <http://www.w3.org/2001/XMLSchema-instance> " xsi:schemaLocation=" http://www.myLeague.com <http://www.myLeague.com> someUrl3"> &team1; &team2; </league>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <TITLE>Validating with external entities and schemas 1.4.4 vs 2.3.0</TITLE>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD> <BODY> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>For more on the same problem, see my unanswered emails in the archives...</FONT></SPAN></DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4></FONT></SPAN> </DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4><U >To save you some pain:</U></FONT></SPAN></DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>Basically, schema does not address physical doc items like entities...they are </FONT></SPAN><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>like word-processor macros that live in the physical world, not the logical.</FONT></SPAN></DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4></FONT></SPAN> </DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>Schema addresses the logical doc, so entities beyond the built-in </FONT></SPAN><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>must be pre-processed out by you before the parser ever sees the file.</FONT></SPAN></DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4></FONT></SPAN> </DIV> <DIV><SPAN class=984011315-21022003><FONT face=Tahoma color=#0000ff size=4>My guess is that the mutant "combo" document worked with old versions of the parser by pure luck. Unfortunately, the default parser in XML Spy also parses these Frankensteins without errors, giving you the illusion that you might be able to use such a thing in production.</FONT></SPAN></DIV> <DIV> </DIV> <P><I><FONT face="Comic Sans MS" color=#0000ff>Walt Fitzharris</FONT></I> </P> <P class=MsoNormal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><FONT face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Stottlemyer, Carl [mailto:carl.stottlemyer@(protected)]<BR><B>Sent:</B> Friday, February 21, 2003 9:19 AM<BR><B>To:</B> xerces-j-user@(protected)<BR><B>Subject:</B> Validating with external entities and schemas 1.4.4 vs 2.3.0<BR><BR></P></FONT> <P><FONT face=Arial size=2>I have a document with structure similar to the xml below. When I use Xerces 1.4.4, I am able to validate the document against the schema without any problems. When I use Xerces 2.3.0 the validation tells me that all of the elements in each of the entities need to be defined (however they are defined in the schema.) It appears to me that the xerces is searching the DTD for the ANY elements without referencing the schema. Any explanation as to why it works in 1.4.4 and not 2.3.0. I would also appreciate any recommendations as to what I need to do to make it work in 2.3.0.</FONT></P> <P><FONT face=Arial size=2>Thanks, Carl</FONT> </P> <P><FONT face=Arial size=2><?xml version="1.0" encoding="UTF-8" ?></FONT> <BR><FONT face=Arial size=2><!-- leagues are validated against the league .xsd schema.</FONT> <BR><FONT face=Arial size=2>The DOCTYPE is included to provide ENTITY references to embedded xml files</FONT> <BR><FONT face=Arial size=2>--></FONT> <BR><FONT face=Arial size=2><!DOCTYPE league[</FONT> <BR><FONT face=Arial size=2> <!ELEMENT league ANY></FONT> <BR><FONT face=Arial size=2> <!ENTITY team1 SYSTEM "someUrl"> </FONT><BR><FONT face=Arial size=2> <!ENTITY team2 SYSTEM "someUrl2">   ; </FONT><BR><FONT face=Arial size=2>]></FONT> <BR><FONT face=Arial size=2><leauge xmlns="<A href="http://www.myLeague.com" target=_blank>http://www.myLeague.com</A>"</FONT> <BR><FONT face=Arial size=2> xmlns:xsi="<A href="http://www.w3.org/2001/XMLSchema-instance" target=_blank>http://www.w3.org/2001/XMLSchema-instance</A>"</FONT> <BR><FONT face=Arial size=2> xsi:schemaLocation="<A href="http://www.myLeague.com" target=_blank>http://www.myLeague.com</A></FONT> <BR> <FONT face=Arial size=2> someUrl3"></FONT> <BR><FONT face=Arial size=2>&team1;</FONT> <BR><FONT face=Arial size=2>&team2;</FONT> <BR><FONT face=Arial size=2></league></FONT> </P></BODY></HTML>
|
|