<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">Le 18/06/2013 15:42, Marcos Douglas a
écrit :<br>
</div>
<blockquote
cite="mid:CA+ixmeYm7MR7-c3ZJ_-0GMR6v+SDRMqWKzMDi1mmUaZRHeC1vg@mail.gmail.com"
type="cite">
<pre wrap="">On Tue, Jun 18, 2013 at 10:32 AM, Michael Van Canneyt
<a class="moz-txt-link-rfc2396E" href="mailto:michael@freepascal.org"><michael@freepascal.org></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
On Tue, 18 Jun 2013, Marcos Douglas wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Tue, Jun 18, 2013 at 9:39 AM, Antonio Fortuny
<a class="moz-txt-link-rfc2396E" href="mailto:a.fortuny@sitasoftware.lu"><a.fortuny@sitasoftware.lu></a> wrote:
</pre>
<blockquote type="cite">
<pre wrap="">
Le 18/06/2013 14:35, Marcos Douglas a écrit :
Hi,
I need to save some huge XML files in HD.
Today I call WriteXMLFile(Doc, AFileName) but I have XML with 5G, 10G..
30G...
What the best way to save "line by line"?
Append chuncks of lines to a TFileStream until source XML file is
exhausted
</pre>
</blockquote>
<pre wrap="">
But I'm using TXMLDocument class to make the XML.
For each line (log) I do this:
(doesn't matter the information in Par variable)
procedure TXMLLogger.Log;
var
I: Integer;
No: TDOMElement;
Par: TParam;
begin
No := FDoc.CreateElement('line');
for I := 0 to FParams.Count-1 do
begin
Par := FParams.Items[I];
TDOMElement(No).SetAttribute(Par.Name, Par.AsString);
end;
FRootNode.AppendChild(No);
FParams.Clear;
end;
At the end, I do some like:
procedure TXMLLogger.Finish;
var
No: TDOMElement;
begin
No := FDoc.CreateElement('finish');
TDOMElement(No).SetAttribute('dh', FmtDateTime(Now));
FRootNode.AppendChild(No);
end;
And the application call:
procedure TXMLLogger.SaveToFile(const AFileName: string);
begin
WriteXMLFile(FDoc, AFileName);
end;
So, there is a way to use TXMLDocument but save line by line more faster?
</pre>
</blockquote>
<pre wrap="">
No. The writer already uses a fixed buffer. Your problem is the use of
TXMLDocument.
</pre>
</blockquote>
<pre wrap="">
Ideas? Maybe do what Antonio Fortuny said before?</pre>
</blockquote>
Yep, a text file: assign, reset, append, close. I use an own build
logger facility (for historical reasons) but I wonder whether
Lazarus (or FPC) does not have such a logger component.<br>
<blockquote
cite="mid:CA+ixmeYm7MR7-c3ZJ_-0GMR6v+SDRMqWKzMDi1mmUaZRHeC1vg@mail.gmail.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">
Simply put: logging to XML (worse: using DOM) is a VERY bad idea.
</pre>
</blockquote>
<pre wrap="">
Well, this is a request of my client. Other process will read this XML.
Thanks,
Marcos Douglas
_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<table
style="font-family:'Calibri','sans-serif';font-size:8.0pt;color:#002f87;border:0;width:auto;">
<tbody>
<tr>
<td style="vertical-align:bottom;padding:40px 20px
25px;border-top:1pt solid #BFBFBF;"> <img alt="Sita
Software"
src="cid:part1.01060502.00060801@sitasoftware.lu"> </td>
</tr>
<tr>
<td style="vertical-align: top; padding: 5px 20px 0;"> <b>Antonio
Fortuny</b><br>
Senior Software engineer<br>
<br>
220, avenue de la Liberté<br>
L-4602 Niederkorn<br>
Tel.: +352 58 00 93 - 93<br>
<a style="color:#002f87;cursor:pointer;text-decoration:
none;" href="http://www.sitasoftware.lu">www.sitasoftware.lu</a><br>
</td>
</tr>
<tr>
<td style="padding:20px 20px 30px;border-bottom: 1pt solid
#BFBFBF;" align="right"> <img alt="Your IT Partner"
src="cid:part3.02050309.01050800@sitasoftware.lu"> </td>
</tr>
</tbody>
</table>
</div>
</body>
</html>