I've put together a demo based on one of the sample programs shipped with Xerces. The demo creates a Xerces GrammarPoolImpl then conducts a number of validating XML parses using that grammar pool when caching is enabled for the parser. The test documents include an XML file referring to a DTD and an XML file referring to an XML schema. Each type of parse is done twice in succession to observe the caching behaviour of Xerces, with a new parser instance created for each parse. The parses done include:
DGXMLScanner without caching involving DTD validation DGXMLScanner with caching involving DTD validation IGXMLScanner without caching involving DTD validation IGXMLScanner with caching involving DTD validation SGXMLScanner without caching involving XML schema validation SGXMLScanner with caching involving XML schema validation I ran with on an Fedora Core 1 linux x86 platform using Xerces 2.6.0. I see a number of surprising things (refer to output below): - parsing fails when caching is enabled whilst using the DGXMLScanner - when using DGXMLScanner or IGXMLScanner for DTD validation, the DTD appears to be re-resolved for each parse. I haven't checked whether the DTD is actually being re-parsed after being resolved each time, but I wonder why it is being resolved each time if it is supposedly being cached - the DTD is being resolved twice on the first parse when parsing with a DTD and caching enabled. This seems questionable. I've attached a tarball containing the files for the demo, which should work after being unpacked into the samples directory. Regards, Daniel doParse dtdDGXML parse #1 resolveEntity("", "example.dtd") parse #2 resolveEntity("", "example.dtd") ---------------------------- doParse dtdDGXMLCaching parse #1 resolveEntity(null, "example.dtd") resolveEntity("", "example.dtd") Fatal Error at (file /home/daniel/xerces/xerces-c-src_2_6_0/samples/GrammarCache/example-dtd.xml, line 2, char 40): An exception occurred! Type:NoSuchElementException, Message:The key '{0}' could not be found in the hash table parse #2 resolveEntity(null, "example.dtd") resolveEntity("", "example.dtd") Fatal Error at (file /home/daniel/xerces/xerces-c-src_2_6_0/samples/GrammarCache/example-dtd.xml, line 2, char 40): An exception occurred! Type:NoSuchElementException, Message:The key '{0}' could not be found in the hash table ---------------------------- doParse dtdIGXML parse #1 resolveEntity("", "example.dtd") parse #2 resolveEntity("", "example.dtd") ---------------------------- doParse dtdIGXMLCaching parse #1 resolveEntity("", "example.dtd") resolveEntity("", "example.dtd") parse #2 resolveEntity("", "example.dtd") ---------------------------- doParse xsd parse #1 resolveEntity("", "example.xsd") parse #2 resolveEntity("", "example.xsd") ---------------------------- doParse xsdCaching parse #1 resolveEntity("", "example.xsd") parse #2 ----------------------------
GrammarCache.tar.gz
Description: application/tar-gz
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]