* Tabs are now considered as whitespace, too, when the reader determines if

a text node would be empty or not
This commit is contained in:
sg 2000-07-09 14:23:42 +00:00
parent b28d595934
commit 8c29307ba9

View File

@ -52,6 +52,7 @@ const
PubidChars: set of Char = [' ', #13, #10, 'a'..'z', 'A'..'Z', '0'..'9', PubidChars: set of Char = [' ', #13, #10, 'a'..'z', 'A'..'Z', '0'..'9',
'-', '''', '(', ')', '+', ',', '.', '/', ':', '=', '?', ';', '!', '*', '-', '''', '(', ')', '+', ',', '.', '/', ':', '=', '?', ';', '!', '*',
'#', '@', '$', '_', '%']; '#', '@', '$', '_', '%'];
WhitespaceChars: set of Char = [#9, #10, #13, ' '];
NmToken: set of Char = Letter + Digit + ['.', '-', '_', ':']; NmToken: set of Char = Letter + Digit + ['.', '-', '_', ':'];
@ -150,7 +151,8 @@ end;
function TXMLReader.SkipWhitespace: Boolean; function TXMLReader.SkipWhitespace: Boolean;
begin begin
Result := False; Result := False;
while buf[0] in [#9, #10, #13, ' '] do begin while buf[0] in WhitespaceChars do
begin
Inc(buf); Inc(buf);
Result := True; Result := True;
end; end;
@ -348,7 +350,7 @@ procedure TXMLReader.ExpectProlog; // [22]
procedure ParseDoctypeDecls; procedure ParseDoctypeDecls;
begin begin
repeat repeat
SkipWhitespace; SkipWhitespace;
until not (ParseMarkupDecl or ParsePEReference); until not (ParseMarkupDecl or ParsePEReference);
ExpectString(']'); ExpectString(']');
end; end;
@ -731,7 +733,7 @@ var
begin begin
// Check if s has non-whitespace content // Check if s has non-whitespace content
i := Length(s); i := Length(s);
while (i > 0) and (s[i] in [#10, #13, ' ']) do while (i > 0) and (s[i] in WhitespaceChars) do
Dec(i); Dec(i);
if i > 0 then if i > 0 then
NewElem.AppendChild(doc.CreateTextNode(s)); NewElem.AppendChild(doc.CreateTextNode(s));
@ -1115,7 +1117,11 @@ end.
{ {
$Log$ $Log$
Revision 1.18 2000-07-09 13:56:09 sg Revision 1.19 2000-07-09 14:23:42 sg
* Tabs are now considered as whitespace, too, when the reader determines if
a text node would be empty or not
Revision 1.18 2000/07/09 13:56:09 sg
* Added support for predefined entities for attribute values * Added support for predefined entities for attribute values
Revision 1.17 2000/07/09 11:39:15 sg Revision 1.17 2000/07/09 11:39:15 sg