mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:19:27 +02:00
* xmlread.pp: when IgnoreComments=True, merge together text nodes that precede and follow the skipped comment. With this fix, the reader finally produces normalized documents in all modes, so remove the corresponding cheat from testing program (xmlts.pp).
git-svn-id: trunk@15442 -
This commit is contained in:
parent
cfae57bccd
commit
8f29def76e
@ -2060,7 +2060,6 @@ var
|
||||
wc: WideChar;
|
||||
begin
|
||||
Result := False;
|
||||
FValue.Length := 0;
|
||||
StoreLocation(FTokenStart);
|
||||
repeat
|
||||
wc := FSource.SkipUntil(FValue, Delim);
|
||||
@ -2083,12 +2082,16 @@ begin
|
||||
end;
|
||||
|
||||
procedure TXMLReader.ParseComment; // [15]
|
||||
var
|
||||
SaveLength: Integer;
|
||||
begin
|
||||
ExpectString('--');
|
||||
SaveLength := FValue.Length;
|
||||
if SkipUntilSeq([#0, '-'], '-') then
|
||||
begin
|
||||
ExpectChar('>');
|
||||
DoComment(FValue.Buffer, FValue.Length);
|
||||
DoComment(@FValue.Buffer[SaveLength], FValue.Length-SaveLength);
|
||||
FValue.Length := SaveLength;
|
||||
end
|
||||
else
|
||||
FatalError('Unterminated comment', -1);
|
||||
@ -2117,6 +2120,7 @@ begin
|
||||
if FSource.FBuf^ <> '?' then
|
||||
SkipS(True);
|
||||
|
||||
FValue.Length := 0;
|
||||
if SkipUntilSeq(GT_Delim, '?') then
|
||||
begin
|
||||
SetString(Value, FValue.Buffer, FValue.Length);
|
||||
@ -2960,8 +2964,11 @@ begin
|
||||
end
|
||||
else if FSource.FBuf^ = '-' then
|
||||
begin
|
||||
DoText(FValue.Buffer, FValue.Length, not nonWs);
|
||||
if not FIgnoreComments then
|
||||
DoText(FValue.Buffer, FValue.Length, not nonWs);
|
||||
ParseComment;
|
||||
if FIgnoreComments then
|
||||
Continue;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
@ -482,7 +482,6 @@ begin
|
||||
end;
|
||||
|
||||
if outURI = '' then Exit;
|
||||
TempDoc.DocumentElement.Normalize;
|
||||
try
|
||||
// reference data must be parsed in non-validating mode because it contains DTDs
|
||||
// only when Notations need to be reported
|
||||
|
Loading…
Reference in New Issue
Block a user