Grammar caching with multiple schemas for the same target namespace
Patrik Stellmann <[email protected]> Sun, 22 Jan 2017 08:04:11 +0100
| Newsgroups | gmane.text.xml.xerces-j.user |
|---|---|
| Message-ID | <[email protected]> |
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