Nevermind. After more digging into this problem I learned that each schema must 
be from a unique namespace in order to be cached. Mine weren't and so only the 
first schema was cached, which explains why only the first document loaded 
correctly.

Not sure this behavior is optimal, but I suppose there are good reasons.

-Brian


-----Original Message-----
From:   Brian Hassink
Sent:   Sun 10/23/2005 12:05 AM
To:     [email protected]
Cc:     
Subject:        help - schema caching problems
Posting request for help again as first attempt went without any response...

I'm trying to cache the schemas used by my documents in order to improve 
parsing performance. The problem I'm running into is that when I enable caching 
via XercesDOMParser::cacheGrammarFromParse(true), only my first document loads 
without errors and all subsequent documents fail. What's strange is that if 
this option is disabled then all my documents load without errors. I've also 
tried pre-loading all my schemas using XercesDOMParser::loadGrammar() but came 
up with with the same results.

Note that I'm using Xerces 2.5.0-1 under Cygwin. Here's what my code looks 
like...
    
parser->setValidationScheme(XERCES_CPP_NAMESPACE::XercesDOMParser::Val_Always);
parser->setDoNamespaces(true);
parser->setDoSchema(true);
parser->cacheGrammarFromParse(true);
parser->setIncludeIgnorableWhitespace(false);
parser->setCreateEntityReferenceNodes(false);

// iterate over my list of documents doing the following...

parser->parse(file);
doc = parser->adoptDocument();

// ...and store the adopted document away for later use


Any pointers would be much appreciated.

-Brian



Reply via email to