NativeXml (3):保存


uses NativeXml;

var
  xml: TNativeXml;

procedure TForm1.FormCreate(Sender: TObject);
begin
  xml := TNativeXml.CreateName('MyRoot');
  ChDir('C:\Temp');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  xml.SaveToFile('Test_Default.xml');  //encoding="UTF-8"

  xml.ExternalEncoding := seUTF8;
  xml.SaveToFile('Test_UTF8.xml');     //encoding="utf-8"

  xml.ExternalEncoding := seAnsi;
  xml.SaveToFile('Test_Ansi.xml');     //encoding="windows-1250"

  xml.ExternalEncoding := seUTF16BE;
  xml.SaveToFile('Test_UTF16BE.xml');  //encoding="unicodeFFFE"

  xml.ExternalEncoding := seUTF16LE;
  xml.SaveToFile('Test_UTF16LE.xml');  //encoding="utf-16"

  xml.ExternalEncoding := seUTF16LE;
  xml.EncodingString := 'UTF-16';
  xml.SaveToFile('Test_UTF16.xml');    //encoding="UTF-16"
end;

你可能感兴趣的:(NativeXml (3):保存)