Hello 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. What am I missing here? Using Xerces 2.7.0 DOM Impl.
Code snippet ================================ _XmlDOMParser->setValidationScheme(_XmlDOMParser->Val_Always); _XmlDOMParser->setDoSchema(false); //load grammar and cache it _XmlDOMParser->setLoadExternalDTD(true); _XmlDOMParser->loadGrammar(dtd, Grammar::DTDGrammarType, true); _XmlDOMParser->setSkipDTDValidation(false); _XmlDOMParser->useCachedGrammarInParse(true); _XmlDOMParser->parse(xmlDoc2Parse); ..... The attempt to parse and validate got the error below: The following error occurred during the XML validation XML Parser Fatal Error in file "/net/sinai/home/d/dcd9420/labs/bcmeXmlLab/boldMetaData-PP-777-D633W101- EAD-51-20070905.xml" <?xml version="1.0" encoding="UTF-8"?> Line 2::Column 92 <!DOCTYPE DOCUMENT SYSTEM "http//web/dtd/ddps_mmm_meta_3.dtd"> Parser Error Message: An exception occurred! Type:NetAccessorException, Message:Could not read from the socket for URL 'http//web/dtd/ddps_mmm_meta_3.dtd' !!! ATTENTION - DON'T WANT TO USE THE DTD SPECIFIED IN THE DOCUMENT SINCE I CAN'T ACCESS IT =================================== Snippet of XML file <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE DOCUMENT SYSTEM http//web/dtd/ddps_mmm_meta_3.dtd"> <DOCUMENT> <APPLICATION VERSION="2.0.3.0507">TECHNICAL DOCUMENTS</APPLICATION> <PRODUCT_NUMBER>D633W101-EAD</PRODUCT_NUMBER>