I have a related question. The document I have is validated against several XML schema files. I store these locally and using XMLGrammarPreparser and XMLGrammarPoolImpl() validation occurs successfully. However I also note that xerces goes off to externally locate the XMLSchema DTD files.
My question(s) is whether I can use a combination of XMLGrammarPreparser/XMLGrammarPoolImpl for local validation of XML schemas and the entity resolver for local resolving of the DTD files. (As it appears XMLGrammarPreparser/XMLGrammarPoolImpl does not support XML schemas and DTDs) John > -----Original Message----- > From: George Cristian Bina [mailto:[EMAIL PROTECTED] > Sent: 23 January 2004 08:24 > To: [EMAIL PROTECTED] > Subject: Re: XML Validation > > > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
