前言
xml是可扩展标记语言,由一系列的元素、属性、值节点等构成的一个树形结构,除了可读性差一点,别的用于存储一些结构化的数据还是比较方便的。这个功能在Unity3d端的实现是比较方便快捷的:
void GetXML1() {
string filePath = Application.streamingAssetsPath + "/xml1.xml";
if (File.Exists(filePath))
{
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(filePath);
XmlNodeList nodes = xmlDoc.SelectSingleNode("rootitem").ChildNodes;
foreach (XmlNode node in nodes)
{
Debug.Log(node.Name + ":" + node.InnerText);
}
}
else
Debug.