Hi Frank,
The cached grammars are owned by the XMLGrammarPool. If you don't
provide your own XMLGrammarPool to a parser, then it will use it's own,
which will be deleted when the parser is deleted.
You can share an XMLGrammarPool amongst threads by locking it using
XMLGrammarPool::lockPool(). Using this method, you should first populate
the grammar pool with the grammars you want. Then you can lock it and
construct as many parsers with it as you need.
The one problem I haven't solved using this method is that Xerces-C
refuses to parse an XML document with an internal DTD subset if the
grammar pool is locked. This means it is not compliant with the XML
specification :-(.
John
Gierschner, Frank wrote:
Hello.
Does the so-called "grammar-caching" take place within the currently
used parser (e.g. DOMBuilder) only [meaning: grammar cache is deleted
when the parser is released] or is the grammar held somewhere in memory
until XMLPlatformUtils::Terminate(); or any other method (like
resetDocumentPool() etc.) is called?
Until now I believe it is attached to the parser but I cannot find an
explicit confirmation for that in the documentation.
If so and grammar-caching throughout the lifetime of my program would be
required is the only way to do so like described here
(http://www-128.ibm.com/developerworks/webservices/library/x-xsdxerc.htm
l) or in using synchronized access to one single parser instance?
Are there additional possibilities without using (de-)serialization,
e.g. can I share a an instance of XMLGrammarPool with multiple parser
instances?
Regards
Frank
--
John Snelson, Oracle Corporation http://snelson.org.uk/john
Berkeley DB XML: http://oracle.com/database/berkeley-db/xml
XQilla: http://xqilla.sourceforge.net