On Thu, 2004-09-16 at 04:02, Fuller, Alex wrote: > A tangential question: > Is it necessary to set the externalSchemaLocation property if you > preload schema Grammars into a GrammarPool? Once the pool is loaded, > it is given to the parser's configuration. What if the pool is not locked? > > As I understand it, an XMLGrammarPreparser can figure out the schema's > namespace as it loads the file. This allows my customers to supply only > a file location for their schema and not force them to provide the > namespace, as well. Is this an incorrect approach? >
It is necessary to set the property, but the value doesn't matter. I do something very similar to what you are implementing, and have this code. Note that in my case rootElementNS is a parameter provided by the user, and this code runs *before* the parsing starts. if (rootElementNS[0] == 0) { // The external-noNamespaceSchemaLocation property has to be set // in order for a root element with no namespace to trigger a // lookup of targetNamespace "" in the grammar pool. But it doesn't // matter what it is set to, because before attempting to load the // referenced schema via its location the parser first checks whether // there is a preloade grammar with targetNamespace="", and we have // just verified above that there is. XMLCh dummySchemaLocation[] = {chNull}; parser->setProperty( XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, dummySchemaLocation); } else { // We must disable any previous setting for the property // externalNoNamespaceSchemaLocation, parser->setProperty( XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation, 0); } I hope this helps. Regards, Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]