读书人

xmlDocument怎么遍历

发布时间: 2012-03-03 15:33:02 作者: rapoo

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;    } 

读书人网 >C#

热点推荐