创业路上(16xia的个人博客2023)

 

NativeXml (12):NativeXmlObjectStorage

摘要:安装包中的 NativeXmlObjectStorage.pas 是 NativeXml 的扩展应用,可以把组件、对象和窗体序列化为 Xml 文件。其中方便使用的是两个类:TsdXmlObjectWriter、TsdXmlObjectReader,也可使用下面三组函数:ComponentCreateFromXmlFile();ComponentCreateFromXmlNode();ComponentCreateFromXmlStream();ComponentCreateFromXmlString();ComponentSaveToXmlFile();ComponentSaveToXmlNo

NativeXml (11):浮点数的有效位数

摘要:uses NativeXml; procedure TForm1.Button1Click(Sender: TObject); var xml: TNativeXml; fVal: Double; begin fVal := 123.456789; xml := TNativeXml.CreateName('List'); xml.XmlFormat := xfReadable; //xml.FloatSignificantDigits := ; with xml.Root.NodeNew('item') do begin WriteString

NativeXml (10):编辑

摘要:uses NativeXml; var xml: TNativeXml; const xmlStr = '' + '' + '张三' + '李四

NativeXml (9):读取

摘要:var xml: TNativeXml; const xmlStr = '' + '' + '张三' + '李四

NativeXml (8):其它添加

摘要:uses NativeXml;procedure TForm1.Button1Click(Sender: TObject);var xml: TNativeXml; node: TXmlNode;begin xml := TNativeXml.CreateName('List'); xml.XmlFormat := xfReadable; node := xml.NodeNewTextType('注释名称', '注释内容', xeComment); xml.Root.NodeAdd(node); node := xml.NodeNewText

NativeXml (7):添加属性

摘要:uses NativeXml; procedure TForm1.Button1Click(Sender: TObject); var xml: TNativeXml; node: TXmlNode; begin xml := TNativeXml.CreateName('List'); xml.XmlFormat := xfReadable; node := xml.Root.NodeNew('item'); node.AttributeAdd('ID', '1'); node.AttributeAdd('age

NativeXml (6):添加节点

摘要:uses NativeXml; procedure TForm1.Button1Click(Sender: TObject); var xml: TNativeXml; node: TXmlNode; begin xml := TNativeXml.CreateName('List'); xml.XmlFormat := xfReadable; // node := xml.Root.NodeNew('item'); node.Value := '张三'; // with xml.Root.NodeNew('item') do

NativeXml (5):事件

摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, NativeXml{!};type TForm1 = class(TForm) Button1: TButton; Button2: TButton; Memo1: TMemo; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private

NativeXml (4):认识根节点

摘要:uses NativeXml;const xmlFile = 'C:\Temp\xml_test_files\basic.xml'; //测试文件var xml: TNativeXml;procedure TForm1.FormCreate(Sender: TObject);begin xml := TNativeXml.Create(nil); xml.LoadFromFile(xmlFile);end;{获取根节点的类名及类的继承关系}procedure TForm1.Button1Click(Sender: TObject);var str: string; myCla

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.Extern

NativeXml (2):对象建立

摘要:相关方法与属性:TNativeXml.Create(...);TNativeXml.CreateEx(...);TNativeXml.CreateName(...);Obj.New;Obj.ReadFromString(...);Obj.VersionString;Obj.EncodingString;测试代码:uses NativeXml; //!const xmlFile = 'C:\Temp\xml_test_files\basic.xml'; //测试文件{使用 Create 建立时可指定属主并随属主一同释放}procedure TForm1.Button1Click

NativeXml (1):下载、安装、测试

粤ICP备15105172号