Hi, I thought we (at least partially) addressed this issue in the JAXP 1.3 implementation. I'd suggest having a look at how the SoftReferenceGrammarPool [1] works, as its purpose is to cache grammars based on both their schema location and target namespace.
Thanks. [1] http://svn.apache.org/viewvc/xerces/java/trunk/src/org/apache/xerces/jaxp/validation/SoftReferenceGrammarPool.java Michael Glavassevich XML Technologies and WAS Development IBM Toronto Lab E-mail: mrgla...@ca.ibm.com E-mail: mrgla...@apache.org Patrik Stellmann <pat...@volleynet.de> wrote on 01/22/2017 02:04:11 AM: > Hi, > > I'm recursively processing DITA maps using the SAXParser with > XMLGrammarPool. All files are in the default namespace but have > different XML schemas associated (set my @xsi:noNamespaceSchemaLocation). > > The problem is that the XMLGrammarPool as well as the SAXParser assumes > that the schema only depends on the targetNamespace. Thus, they will use > the same schema for a topic file as it used for a map file. > > I already implemented my own XMLGrammarPool class that checks if two > schema descriptions are equal based on their system id. But it seems > that the parser stores a mapping between namespace and systemId. Thus, > it asks the grammar pool for a schema with the map system id when > processing a topic. > > My current workaround is to create a new instance of the SAXParser for > each file I'm processing. This works fine, but I'm wondering if I could > improve the performance by reusing the same instance for all files. But > I couldn't find out how to change the behavior for getting the grammar!? > > Thanks for any hints. > > Regards, > Patrik > > --------------------------------------------------------------------- > To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org > For additional commands, e-mail: j-users-h...@xerces.apache.org