In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "how to use Delphi NativeXml", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use Delphi NativeXml" this article.
NativeXml can be downloaded on the official website, after download, put the folder in the designated place, open DELPHI to reference the NativeXml path in its environment variables, and then reference the NativeXml unit in the program, we can use NativeXml.
Method properties of NativeXml:
ANativeXml: = TNativeXml.Create (Self); / / create
ANativeXml.XmlFormat: = xfReadable; / / format
ANativeXml.EncodingString: = "UTF-8"; / / Encoding
ANativeXml.ExternalEncoding: = seUTF8
ANativeXml.LoadFromFile (); / / Import a XML file from a folder
ANativeXml.SaveToFile (); / / XML file is saved to a folder
The method properties of the node:
The root node of the ANativeXml.Root;//XML file, notice that everything starts from the root
ANativeXml.Root.NodeByName ('node name'); / / obtain the node through the node name
The attribute object of the NativeXml.Root.Attributes;// node
The word node object of the NativeXml.Root.ChildContainers;// node
NativeXml.Root.NodeNew (); / / add new child nodes
NativeXml.Root.Name;// node name
NativeXml.Root.Value;// Node valu
Var Form1: TForm1; xml:TNativeXml; const xmlstr='+'+ 'Zhang San' +'Li Si'+ 'Wang Wu' +'; procedure TForm1.btn1Click (Sender: TObject); var node:TXmlNode; iSender Integer; begin for i: = 0 to xml.Root.NodeCount-1 do begin node:=xml.Root [I]; mmo2.Lines.Add (node.Value) Mmo2.Lines.Add (node.AttributeByName ['age'] .value); mmo2.Lines.Add (node.Attributes [0] .WriteToString); end; end.
Output result: Zhang San
twenty-one
ID= "No.1"
Li Si
twenty-two
ID= "No.2"
Wang Wu
thirty-three
ID= "No.3"
The above is all the contents of this article "how to use Delphi NativeXml". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.