Tip 1
The difference between XmlNode.InnerText and .InnerXml is: the former changes the < and > in the content into < and > respectively. Therefore, programs that want to merge two XmlDocument can only use
XmlDocumentFragment.InnerXml = XmlNode.OuterXml
Tip 2
/XPath: string end-with
Tips 3
If an XML document fails to load, it is not legal at all; whether it meets the requirements of a certain Schema (XSD) is a validity check by using the Schemas and ValidationType attributes of the XmlValidatingReader object.
Tips 4
The XmlDataDocument class is derived from XmlDocument. The most important thing is to add a DataSet attribute. However, this class is not provided by System.Xml, but by System.Data. For applications that always have to deal with the database, they have to reference System.Data anyway, so it is better to use XmlDataDocument entirely.
Tips 5
How to save the DataSet updates in the XmlDataDocument object to the database? DataSet itself has an AcceptChanges method, so just need:
xmlDataDoc.DataSet.AcceptChanges();
The above is the detailed content of Five XML Tips. For more information, please follow other related articles on the PHP Chinese website!