mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
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:
parent
fb676b3d9a
commit
0bf0a5d5e4
4 changed files with 31 additions and 5 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
* Source/NSDistributedNotificationCenter.m: Changed to explicitly
|
* Source/NSDistributedNotificationCenter.m: Changed to explicitly
|
||||||
use a socket port name server for network wide notifications.
|
use a socket port name server for network wide notifications.
|
||||||
|
* Source/Additions/GSXML.m: Added ([-abortParser])
|
||||||
|
* Source/NSXMLParser.m: Use new abort method.
|
||||||
|
|
||||||
2004-10-21 Fred Kiefer <FredKiefer@gmx.de>
|
2004-10-21 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
|
|
@ -191,6 +191,7 @@
|
||||||
withData: (NSData*)data;
|
withData: (NSData*)data;
|
||||||
+ (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding;
|
+ (NSString*) xmlEncodingStringForStringEncoding: (NSStringEncoding)encoding;
|
||||||
|
|
||||||
|
- (void) abortParsing;
|
||||||
- (int) columnNumber;
|
- (int) columnNumber;
|
||||||
- (GSXMLDocument*) document;
|
- (GSXMLDocument*) document;
|
||||||
- (BOOL) doValidityChecking: (BOOL)yesno;
|
- (BOOL) doValidityChecking: (BOOL)yesno;
|
||||||
|
|
|
@ -1808,6 +1808,25 @@ static NSString *endMarker = @"At end of incremental parse";
|
||||||
return xmlEncodingString;
|
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.
|
* 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;
|
xmlExternalEntityLoader oldLoader;
|
||||||
int oldWarnings;
|
int oldWarnings;
|
||||||
|
|
||||||
|
if (lib == NULL || ((xmlParserCtxtPtr)lib)->disableSAX != 0)
|
||||||
|
{
|
||||||
|
return; // Parsing impossible or disabled.
|
||||||
|
}
|
||||||
|
|
||||||
oldLoader = xmlGetExternalEntityLoader();
|
oldLoader = xmlGetExternalEntityLoader();
|
||||||
oldWarnings = xmlGetWarningsDefaultValue;
|
oldWarnings = xmlGetWarningsDefaultValue;
|
||||||
NS_DURING
|
NS_DURING
|
||||||
|
|
|
@ -309,7 +309,7 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
|
||||||
#define myHandler ((NSXMLSAXHandler*)_handler)
|
#define myHandler ((NSXMLSAXHandler*)_handler)
|
||||||
|
|
||||||
- (void) abortParsing
|
- (void) abortParsing
|
||||||
{ // FIXME
|
{
|
||||||
NSDictionary *d;
|
NSDictionary *d;
|
||||||
NSString *e;
|
NSString *e;
|
||||||
NSError *error;
|
NSError *error;
|
||||||
|
@ -323,14 +323,13 @@ NSString* const NSXMLParserErrorDomain = @"NSXMLParserErrorDomain";
|
||||||
userInfo: d];
|
userInfo: d];
|
||||||
ASSIGN(myHandler->_lastError, error);
|
ASSIGN(myHandler->_lastError, error);
|
||||||
[myHandler->_delegate parser: myHandler->_owner parseErrorOccurred: error];
|
[myHandler->_delegate parser: myHandler->_owner parseErrorOccurred: error];
|
||||||
[NSException raise: NSGenericException format: @"[%@-%@] not yet implemented",
|
[myParser abortParsing];
|
||||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
DESTROY((id)_parser);
|
DESTROY(_parser);
|
||||||
DESTROY((id)_handler);
|
DESTROY(_handler);
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue