Implement abort of parsing.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20255 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-10-24 12:29:31 +00:00
parent fb676b3d9a
commit 0bf0a5d5e4
4 changed files with 31 additions and 5 deletions

View file

@ -1808,6 +1808,25 @@ static NSString *endMarker = @"At end of incremental parse";
return xmlEncodingString;
}
/**
* If called by a SAX callback routine, this method will terminate
* the parsiong process.
*/
- (void) abortParsing
{
if (lib != NULL)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)lib;
// Stop SAX callbacks
ctxt->disableSAX = 1;
// Stop incoming data being parsed.
ctxt->instate = XML_PARSER_EOF;
// Pretend we are at end of file (nul byte).
if (ctxt->input != NULL) ctxt->input->cur = "";
}
}
/**
* If executed during a parse operation, returns the current column number.
*/
@ -2274,6 +2293,11 @@ static NSString *endMarker = @"At end of incremental parse";
xmlExternalEntityLoader oldLoader;
int oldWarnings;
if (lib == NULL || ((xmlParserCtxtPtr)lib)->disableSAX != 0)
{
return; // Parsing impossible or disabled.
}
oldLoader = xmlGetExternalEntityLoader();
oldWarnings = xmlGetWarningsDefaultValue;
NS_DURING