日期:2014-05-18  浏览次数:20782 次

xmlDocument如何遍历?
如何遍历xmlDocument中流的内容
譬如
我要找每个节点中<aaa>的innerText

------解决方案--------------------
C# code

    using System.Xml;

    public IList GetCollection()
    {
        ArrayList aaaCollection = new ArrayList();
        XmlDocument doc = new XmlDocument();
        doc.Load("xml文件路径");
        XmlNodeList nodeList = doc.GetElementsByTagName("aaa"); //获取aaa节点集合
        foreach (XmlNode node in nodeList)
        {
            aaaCollection.Add(node.InnerText);
        }
        return aaaCollection;
    }