Ok, If I understand your comments correctly, loading a grammar does not override the reference specified in an XML instance. So, if the instance has an outdated DTD reference and I want to parse against a later version, using loadGrammar will cause the Parser to parse against both DTD's instead of only against the one loaded via loadGrammar. If this is correct, then how can I specify a specific DTD to parse against rather than the one specified in the XML instance?
Thanks DeWayne -----Original Message----- From: Boris Kolpackov [mailto:bo...@codesynthesis.com] Sent: Tuesday, February 03, 2009 12:20 AM To: c-users@xerces.apache.org Subject: Re: Correct Usage of LoadGrammar method for Xerces 2.7.0 Hi DeWayne, Dantzler, DeWayne C <dewayne.c.dantz...@boeing.com> writes: > I thought that calling the methods loadGrammar and > usedCachedGrammarInParse would force the parser to use the grammar > just loaded instead of loading the grammar specified by the instance > document. I tried the following below and it appears that the parser > attempted to use the DTD specified in the XML file rather than the one > I loaded and cached. Unlike XML Schema which has a target namespace as a grammar identifier, for DTD there is no way for the parser to know that the grammar in cache is the same as the one referenced from XML instance. So, in your case, the parser will use both grammars. One way to change this might be to do setLoadExternalDTD(false). Boris -- Boris Kolpackov, Code Synthesis Tools http://codesynthesis.com/~boris/blog Open source XML data binding for C++: http://codesynthesis.com/products/xsd Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde