fixed xml writer to use current line endings

git-svn-id: trunk@9758 -
This commit is contained in:
mattias 2006-08-27 21:19:38 +00:00
parent ba506191c9
commit 358af7d5d7
2 changed files with 6 additions and 3 deletions

View File

@ -263,9 +263,11 @@ begin
x := 1; x := 1;
y := 1; y := 1;
while apos < buf do begin while apos < buf do begin
if apos[0] = #10 then begin if apos^ in [#10,#13] then begin
Inc(y); Inc(y);
x := 1; x := 1;
if (apos[1] in [#10,#13]) and (apos[0]<>apos[1]) then
inc(apos);
end else end else
Inc(x); Inc(x);
Inc(apos); Inc(apos);

View File

@ -65,6 +65,7 @@ const
(@WriteElement, @WriteAttribute, @WriteText, @WriteCDATA, @WriteEntityRef, (@WriteElement, @WriteAttribute, @WriteText, @WriteCDATA, @WriteEntityRef,
@WriteEntity, @WritePI, @WriteComment, @WriteDocument, @WriteDocumentType, @WriteEntity, @WritePI, @WriteComment, @WriteDocument, @WriteDocumentType,
@WriteDocumentFragment, @WriteNotation); @WriteDocumentFragment, @WriteNotation);
LineEnd: shortstring = LineEnding;
procedure WriteNode(node: TDOMNode); procedure WriteNode(node: TDOMNode);
begin begin
@ -116,7 +117,7 @@ procedure Stream_WriteLn(const Buffer; Count: Longint);
begin begin
if Count > 0 then begin if Count > 0 then begin
stream.Write(Buffer, Count); stream.Write(Buffer, Count);
stream.WriteByte(10); stream.Write(LineEnd[1],length(LineEnd));
end; end;
end; end;
@ -139,7 +140,7 @@ end;
procedure wrtLineEnd; procedure wrtLineEnd;
begin begin
wrt(#10,1); wrt(LineEnd[1],length(LineEnd));
end; end;
// ------------------------------------------------------------------- // -------------------------------------------------------------------