The JAXP Schema created through SchemaFactory.newSchema() caches grammars (through SoftReferences [1]) by their schema location. It's been quite awhile since I've looked at how this works, but it wouldn't surprise me if Xerces calls your LSResourceResolver each time you validate in order to give your application an opportunity to redirect the schema location and then use the value returned from the LSResourceResolver to look up the cached grammar.
Thanks. [1] http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/jaxp/validation/SoftReferenceGrammarPool.java?annotate=699892 Michael Glavassevich XML Technologies and WAS Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Robert Huffman <robert.huff...@gmail.com> wrote on 12/01/2013 05:04:17 PM: > I must parse documents that may use a large number of fairly large > XSDs. However, the large majority of documents will not use most of > those XSDs. Therefore, I would like to use a custom > LSResourceResolver to resolve the target namespaces to local > resources during parsing rather than building a Schema object that > has all the grammars loaded up front. > > Unfortunately, as nearly as I can tell, grammars loaded through the > use of a LSResourceResolver are never cached in the grammar pool. Is > that correct? Is there some nuance I'm missing? --------------------------------------------------------------------- To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org For additional commands, e-mail: j-users-h...@xerces.apache.org