Grammar* XercesDOMParser::loadGrammar(const InputSource& source, const short grammarType, const bool toCache) { // Avoid multiple entrance if (getParseInProgress()) ThrowXMLwithMemMgr(IOException, XMLExcepts::Gen_ParseInProgress, fMemoryManager); ResetParseType resetParse(this, &XercesDOMParser::resetParse); Grammar* grammar = 0; try { setParseInProgress(true); if (grammarType == Grammar::DTDGrammarType) getScanner()->setDocTypeHandler(0); grammar = getScanner()->loadGrammar(source, grammarType, toCache); if (grammarType == Grammar::DTDGrammarType) getScanner()->setDocTypeHandler(this); setParseInProgress(false); } catch(const OutOfMemoryException&) { resetParse.release(); throw; } return grammar; }
void XercesDOMParser::resetParse() { if (getScanner()->getDocTypeHandler() == 0) { getScanner()->setDocTypeHandler(this); } setParseInProgress(false); }