Hi Boris,
Thanks for looking into this problem for me.
In XQilla the grammars are copied from the DOMBuilder to an
XMLGrammarPool owned by the DOMXPathExpression to make them accessible
in a thread safe manner. Looking at the DOM 3 specs, nothing is said
about the thread-safety of DOMXPathExpression - I think that I can
remove the copying if we agree that DOMXPathExpression should not be
thread-safe.
Otherwise, I'm happy with the string pool syncing work-around.
John
Boris Kolpackov wrote:
Hi John,
John Snelson <[EMAIL PROTECTED]> writes:
I realise I'm probably doing things that most people won't ever need to
do with Xerces-C. Never-the-less is what I'm trying to do valid, and if
so is the IllegalArgumentException a bug in Xerces-C?
I think what you are doing is valid however the implementation of the
orphan/adopt grammar in XMLGrammarPool appears to have a bug. I have
done some debugging and my findings are documented in this bug report:
https://issues.apache.org/jira/browse/XERCESC-1798
As mentioned in the report, fixing this bug properly won't be easy
however, there is a fairly straightforward workaround which boils
down to the following code fragment (using your test case):
...
XMLGrammarPoolImpl *newgrpool =
new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager);
// Copy string pool contents.
//
const XMLStringPool* src = grpool->getURIStringPool ();
XMLStringPool* dst = newgrpool->getURIStringPool ();
for (unsigned int i = 1; i < src->getStringCount () + 1; ++i)
dst->addOrFind (src->getValueForId (i));
...
Another option would be to try to get rid of copying altogether if
possible.
Boris
--
John Snelson, Oracle Corporation http://snelson.org.uk/john
Berkeley DB XML: http://oracle.com/database/berkeley-db/xml
XQilla: http://xqilla.sourceforge.net
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]