Hi,
Even if you do not validate the document the parser checks it to be
wellformed. Now if you look at the XML specification you will find that one
of the requirements for a document to be wellformed is to have each of the
parsed entities which is referenced directly or indirectly within the
document well-formed [1]. The DTD external subset is, accroding with the
specification, a special kind of external entity [2] and you can see Tim
Bray's clarification that this is an external parsed entity [3]. Therefore
the parser has to access the DTD external subset even if it does not perform
validation.
Also you can see a description of what Xerces does even if it does not
validate in the Xerces FAQs [4].
If what you are looking for is to prevent the reading of the DTD file then
you can set an entity resolver on the parser and in the implementation of
the entity resolver you can for instance resolve everything to an empty
stream:
import java.io.StringReader;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
public class FakeResolver implements EntityResolver {
public InputSource resolveEntity(String publicId, String systemId) {
return new InputSource(new StringReader(""));
}
}
[1] http://www.w3.org/TR/REC-xml#sec-well-formed
[2] http://www.xml.com/axml/target.html#NT-prolog
[3] http://www.xml.com/axml/notes/ExtSubIsEnt.html
[4] http://xml.apache.org/xerces2-j/faq-write.html#faq-3
Best Regards,
George
-------------------------------------------------------------
George Cristian Bina mailto:[EMAIL PROTECTED]
<oXygen/> XML Editor - http://www.oxygenxml.com/
----- Original Message -----
From: "Varadharajan Sethuraman" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 23, 2004 7:10 AM
Subject: XML Validation
> Hi,
>
> XML File
> ---------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE personnel SYSTEM "personal.dtd">
> <personnel>
>
> <person id="Big.Boss">
> <name><family>Boss</family>
> <given>Big</given></name>
> <email>[EMAIL PROTECTED]</email>
> <link subordinates="one.worker two.worker
> three.worker four.worker five.worker"/>
> </person>
> </personnel>
>
> I am trying to parse the above xml file using Xerces
> DOM Parser i had given setValidation(false);
> eventhough it is looking for the DTD ("personal.dtd")
> file.
>
> is it a bug or not? if not then what is the solution
> for that?
>
> Regards
> Varadharajan S
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]