(Delphi ActiveX) Xml.ChildContent Example #2
Another Xml.UpdateChildContent example...
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;
...
procedure TForm1.Button1Click(Sender: TObject);
var
xml: TChilkatXml;
sbValue: TChilkatStringBuilder;
i: Integer;
begin
xml := TChilkatXml.Create(Self);
xml.Tag := 'abc';
sbValue := TChilkatStringBuilder.Create(Self);
i := 0;
while i < 10 do
begin
xml.I := i;
sbValue.Clear();
sbValue.AppendInt(i);
xml.UpdateChildContent('xyz|test[i]',sbValue.GetAsString());
i := i + 1;
end;
Memo1.Lines.Add(xml.GetXml());
// Output is:
// <?xml version="1.0" encoding="utf-8" ?>
// <abc>
// <xyz>
// <test>0</test>
// <test>1</test>
// <test>2</test>
// <test>3</test>
// <test>4</test>
// <test>5</test>
// <test>6</test>
// <test>7</test>
// <test>8</test>
// <test>9</test>
// </xyz>
// </abc>
end;
|