mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-16 23:21:57 +02:00
+ Implement TSAXReader.Abort method, which can be used to end the parsing prematurely (Mantis #16703)
git-svn-id: trunk@15414 -
This commit is contained in:
parent
87555e084a
commit
73bafe0444
@ -177,6 +177,7 @@ type
|
||||
protected
|
||||
FCurColumnNumber, FCurLineNumber: Integer;
|
||||
FCurPublicID, FCurSystemID: SAXString;
|
||||
FStopFlag: Boolean;
|
||||
|
||||
function GetFeature(const Name: String): Boolean; virtual;
|
||||
function GetProperty(const Name: String): TObject; virtual;
|
||||
@ -213,6 +214,7 @@ type
|
||||
procedure Parse(AInput: TSAXInputSource); virtual; abstract; overload;
|
||||
procedure Parse(const SystemID: SAXString); virtual; overload;
|
||||
procedure ParseStream(AStream: TStream);
|
||||
procedure Abort;
|
||||
|
||||
// Current location
|
||||
property CurColumnNumber: Integer read FCurColumnNumber;
|
||||
@ -653,6 +655,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSAXReader.Abort;
|
||||
begin
|
||||
FStopFlag := True;
|
||||
end;
|
||||
|
||||
function TSAXReader.DoResolveEntity(const PublicID,
|
||||
SystemID: SAXString): TSAXInputSource;
|
||||
begin
|
||||
|
@ -150,7 +150,8 @@ begin
|
||||
end;
|
||||
|
||||
FEndOfStream := False;
|
||||
while True do
|
||||
FStopFlag := False;
|
||||
while not FStopFlag do
|
||||
begin
|
||||
// Read data into the input buffer
|
||||
BufferSize := AInput.Stream.Read(Buffer, MaxBufferSize);
|
||||
@ -161,7 +162,7 @@ begin
|
||||
end;
|
||||
|
||||
BufferPos := 0;
|
||||
while BufferPos < BufferSize do
|
||||
while (BufferPos < BufferSize) and not FStopFlag do
|
||||
case ScannerContext of
|
||||
scUnknown:
|
||||
case Buffer[BufferPos] of
|
||||
|
@ -141,7 +141,8 @@ begin
|
||||
end;
|
||||
|
||||
FEndOfStream := False;
|
||||
while True do
|
||||
FStopFlag := False;
|
||||
while not FStopFlag do
|
||||
begin
|
||||
// Read data into the input buffer
|
||||
BufferSize := AInput.Stream.Read(Buffer, MaxBufferSize);
|
||||
@ -152,7 +153,7 @@ begin
|
||||
end;
|
||||
|
||||
BufferPos := 0;
|
||||
while BufferPos < BufferSize do
|
||||
while (BufferPos < BufferSize) and not FStopFlag do
|
||||
case ScannerContext of
|
||||
scUnknown:
|
||||
case Buffer[BufferPos] of
|
||||
@ -337,9 +338,7 @@ procedure TSAXXMLReader.EnterNewScannerContext(NewContext: TXMLScannerContext);
|
||||
var
|
||||
Attr: TSAXAttributes;
|
||||
TagName: String;
|
||||
Found: Boolean;
|
||||
Ent: SAXChar;
|
||||
i: Integer;
|
||||
begin
|
||||
case ScannerContext of
|
||||
scWhitespace:
|
||||
|
Loading…
Reference in New Issue
Block a user