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

-- 
Boris Kolpackov, Code Synthesis Tools   http://codesynthesis.com/~boris/blog
Open source XML data binding for C++:   http://codesynthesis.com/products/xsd
Mobile/embedded validating XML parsing: http://codesynthesis.com/products/xsde

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to