Note:
- '=>' Represents the return value
- References: click here!
1: Create a Xml Document
2: Write Xml document (must ensure that the root element)
- XmlDocument Xd (instantiate an object)
- CreateXmlDeclaration => XmlDecalration (document declaration)
- Xd.AppendChild (add node)
- Xd.CreateElement => XmlElement Xe (create root)
- Xd.AppendChild (root node added to the document)
- Xe.AppendChild (add a node to node)
- Xe.innerText (Set / Get the value associated with the node)
- Xe.SetAttribute (set property)
- Xd.Save (save file)
3: Read Xml document
- XmlDocument Xd (instantiate an object)
- Xd.Load (loading a Xml file)
- Xd.SelectSingleNode => XmlNode node (the first node is obtained qualified)
- node.ChildNodes => XmlNodeList (obtained all child nodes of the node; foreach loop through use)
- XmlElement Xe = (XmlElement) node (type display conversion)
- Xe.GetAttribute (obtaining property)
- Xe.Name => String (get the label name, node name)
- Xe.InnerText => String (get / set value corresponding)
- Xd.Save (Save the file to prevent modification)
Disclaimer: This article is a blogger original article, if reproduced, please indicate the source.
Disclaimer: This article is a blogger original article, if reproduced, please indicate the source.