zoukankan      html  css  js  c++  java
  • 遍历简单XML节点

    原文发布时间为:2009-08-26 —— 来源于本人的百度文章 [由搬家工具导入]

    <?xml version="1.0" encoding="gb2312" ?>
    <root>
    <name id="1">sdfsdf</name>
    <name id="2">sdgsd</name>
    <name id="3">sdf<name>

    </root>

    string url = Server.MapPath("../XML/zone.xml");
            System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument();
            xdoc.Load(url);
            System.Xml.XmlNodeList nodeList = xdoc.SelectNodes("root/name");
            foreach (System.Xml.XmlNode node in nodeList)
            {
                string strID = node.Attributes["id"].InnerText;
                if (strID=="1")
                {
                    Response.Write(node.InnerXml);
                }

            }

  • 相关阅读:
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    LeetCode
    iOS开发系列--IOS程序开发概览
    iOS开发系列—Objective-C之Foundation框架
  • 原文地址:https://www.cnblogs.com/handboy/p/7153355.html
Copyright © 2011-2022 走看看