Re: Grammar caching with multiple schemas for the same target namespace
Patrik Stellmann <[email protected]> Tue, 31 Jan 2017 14:43:25 +0100
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the hint. My own implementation was already very close to that of SoftReferenceGrammarPool. However, even when using the exact implementation of SoftReferenceGrammarPool I still get an error for unknown root element when parsing the second document with a different schema. So the problem and solution seem to lay outside of the grammar pool but somewhere in the xml reader. Do you have maybe another idea where to look? Thanks and regards, Patrik Am 23.01.2017 um 17:09 schrieb Michael Glavassevich: > 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: [email protected] > E-mail: [email protected] > > Patrik Stellmann <[email protected]> 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: [email protected] > > For additional commands, e-mail: [email protected] >