LoadXml是加载xml字符串。参数是xml的内容。Load加载的是一个xml文件。参数是文件路径。 示例一:
public static void ParseXml(WWW www) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(www.text); XmlNodeList nodeList = xmlDoc.SelectSingleNode("rank").ChildNodes; }示例二:
public static void LoadCon() { XmlDocument xml = new XmlDocument(); XmlReaderSettings set = new XmlReaderSettings(); set.IgnoreComments = true; //xml.Load(XmlReader.Create(("file://" + Application.dataPath + path), set)); xml.Load(XmlReader.Create(("jar:file://" + Application.dataPath + "!/assets/" + path), set)); XmlNodeList xmlNodeList = xml.SelectSingleNode("Property").ChildNodes; }
时间: 2024-10-12 20:51:38