注册 登录
编程论坛 ASP.NET技术论坛

读取XML问题

lmyh5201 发布于 2008-10-27 15:29, 908 次点击
<one value="100" text="北京">
    <two value="101" text="昌平">
      <three value="102" text="昌平">
      </three>
    </two>
    <two value="103" text="朝阳">
      <three value="104" text="朝阳">
      </three>
    </two>
    <two value="105" text="崇文">
      <three value="106" text="崇文">
      </three>
    </two>
    <two value="107" text="大兴">
      <three value="108" text="大兴">
      </three>
    </two>
    <two value="109" text="东城">
      <three value="110" text="东城">
      </three>
    </two>
    <two value="111" text="房山">
      <three value="112" text="房山">
      </three>
    </two>
    <two value="113" text="丰台">
      <three value="114" text="丰台">
      </three>
    </two>
    <two value="115" text="海淀">
      <three value="116" text="海淀">
      </three>
    </two>
    <two value="117" text="怀柔">
      <three value="118" text="怀柔">
      </three>
    </two>
    <two value="119" text="门头沟">
      <three value="120" text="门头沟">
      </three>
    </two>
    <two value="121" text="密云">
      <three value="122" text="密云">
      </three>
    </two>
    <two value="123" text="平谷">
      <three value="124" text="平谷">
      </three>
    </two>
    <two value="125" text="石景山">
      <three value="126" text="石景山">
      </three>
    </two>
    <two value="127" text="顺义">
      <three value="128" text="顺义">
      </three>
    </two>
    <two value="129" text="通州">
      <three value="130" text="通州">
      </three>
    </two>
    <two value="131" text="西城">
      <three value="132" text="西城">
      </three>
    </two>
    <two value="133" text="宣武">
      <three value="134" text="宣武">
      </three>
    </two>
    <two value="135" text="延庆">
      <three value="136" text="延庆">
      </three>
    </two>
  </one>

怎么根据传过来的值来读取出<two>里的内容阿,不要<three>里的,不要用JS写
2 回复
#2
铲铲2008-10-27 16:05
XmlDocument doc = new XmlDocument();
doc.ReadXml("你上面的那一堆");
doc.ChildNodes[0].ChildNodes 这个集合即使two的集合。
#3
fly_yan2008-10-29 16:26
DataTable dt
chatHis.ReadXml("你的xml的文件路径");
返回类型一个表格
1