- Check XML node is exists:
- tmpDoc.Load(filePath);
- XmlNode rootNode = tmpDoc.SelectSingleNode("Controls");
-
- XmlNodeList slblNodeList = null;
- if (rootNode.SelectSingleNode("SmartLabels") != null)
- slblNodeList = rootNode.SelectSingleNode("SmartLabels").ChildNodes;
rootNode.SelectSingleNode("SmartLabels") != null这一句很有用!!!
Reference Website:
http://answers.unity3d.com/questions/162298/xml-check-if-a-node-exists.html