读取XML ,IOS、Android、PC

前端之家收集整理的这篇文章主要介绍了读取XML ,IOS、Android、PC前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
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

猜你在找的XML相关文章