XmlDocument xmlDoc = new XmlDocument(); TextAsset textAsset = (TextAsset) Resources.Load("tips",typeof (TextAsset)); xmlDoc.LoadXml(textAsset.text); XmlNodeList node = xmlDoc.SelectSingleNode("plist").ChildNodes; foreach (XmlElement nodeList in node) { foreach (XmlElement xe in nodeList) { if (xe.Name == "array") { int i = 0; _tips = new string[xe.ChildNodes.Count]; foreach (XmlElement xe1 in xe.ChildNodes) { _tips[i] = xe1.InnerText; i++; } break; } } // } }
用此种方法!
XmlDocument xmlDoc = new XmlDocument(); TextAsset textAsset = (TextAsset) Resources.Load("tips",typeof (TextAsset)); xmlDoc.LoadXml(textAsset.text);原文链接:https://www.f2er.com/xml/298663.html