My application encounters XML documents that all
conform to the same DTD. I create an XMLReader using
the SAX APIs:
SAXParserFactory factory =
SAXParserFactory.newInstance();
factory.setValidating(bValidating);
SAXParser parser = factory.newSAXParser();
        
XMLReader xmlreader = parser.getXMLReader();
xmlreader.setFeature( XERCES_FEATURE_VALIDATION,
bValidating );

I also set a grammar pool: 
xmlreader.setProperty("http://apache.org/xml/properties/internal/grammar-pool";,
grammarPool);

Now, DTD caching seems to work fine for documents that
have a DOCTYPE declaration. But for documents where no
such declaration is present, stepping through the code
shows that xerces loads up the DTD (through entity
resolver) and scans it. It is later able to find the
appropriate DTD in the grammar pool I supplied. 

My questions are:
1. The scanning is wasting CPU cycles that I can't
spare - Is there a way to make xerces back off to a
cached grammar if DOCTYPE declaration is missing?
2. Once it *does* find the cached grammar, I am not
sure if it is using it or parsing the DTD that it
scanned. Does anyone know?

Any help will be greatly appreciated.
Thanks.
Raj

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to