在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
unit Unit1;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, xmldom, XMLIntf, msxmldom, XMLDoc, StdCtrls; type TForm1 = class(TForm) XMLDocument1: TXMLDocument; Memo1: TMemo; procedure FormCreate(Sender: TObject); end; var Form1: TForm1; implementation {$R *.dfm} //读取或设置 xml 的编码与版本号 procedure TForm1.FormCreate(Sender: TObject); begin XMLDocument1.LoadFromFile('c:\temp\test.xml'); ShowMessage(XMLDocument1.Version); {1.0} ShowMessage(XMLDocument1.Encoding); {gb2312} {另外, 这两个属性都是可写的, 譬如:} XMLDocument1.Encoding := 'UTF-8'; Memo1.Lines := XMLDocument1.XML; {这时会显示乱码} end; end. 出处:http://www.cnblogs.com/del/archive/2008/01/03/1024883.html |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论