<?xml version="1.0" encoding="UTF-8" ?> <id> <path>sdkfjsfdj</path> <time>60</time> </id>
Using System.XML;
XmlDocument doc = new XmlDocument ();
doc.Load (Application.dataPath + @"/myx.xml"); //读取xml的路径
XmlNodeList nodel = doc.SelectSingleNode ("id").ChildNodes; //查询xml的节点
foreach(XmlElement xe in nodel){
//xe.GetAttribute("id"); //id节点属性的内容
if(xe.Name=="path"){ //xe.Name 为id节点下的所有节点名
Debug.Log(xe.InnerText); //节点内容
}
}
print (doc.OuterXml) //输出所有xml内容
//元素(Element),属性(Attribute),文本(Text)
momo: http://www.xuanyusong.com/archives/1901
C#读取XML: http://www.cnblogs.com/a1656344531/archive/2012/11/28/2792863.html
Unity读取xml: http://blog.csdn.net/awnuxcvbn/article/details/9298395
时间: 2024-09-30 18:35:45