怎么把一个xml文件绑定到Flex中的tree上 5
如下所示:<?xmlversion="1.0"encoding="utf-8"?>-<Device_001_FixedInfoDTO><DEVICENAME>一号</DE...
如下所示: <?xml version="1.0" encoding="utf-8" ?>
- <Device_001_FixedInfoDTO>
<DEVICENAME>一号</DEVICENAME>
</Device_001_FixedInfoDTO>
- <Device_001_FixedInfoDTO>
<DEVICENAME>二号</DEVICENAME>
</Device_001_FixedInfoDTO>
- <Device_001_FixedInfoDTO> 展开
- <Device_001_FixedInfoDTO>
<DEVICENAME>一号</DEVICENAME>
</Device_001_FixedInfoDTO>
- <Device_001_FixedInfoDTO>
<DEVICENAME>二号</DEVICENAME>
</Device_001_FixedInfoDTO>
- <Device_001_FixedInfoDTO> 展开
展开全部
找到节点
XmlDocument doc = new XmlDocument();
doc.Load(fileWay);
XmlNode xm = doc.SelectNodes("//head")[Parse].ChildNodes[Child];
string nodeUrl = xm.Attributes[1].Value;
WebRequest request = WebRequest.Create(nodeUrl); //通过rss文档地址建立Web请求对象
WebResponse response = request.GetResponse(); //通过请求对象获得Web响应对象
Stream str = response.GetResponseStream(); //通过Web响应对象获得信息流
XmlDocument xDoc = new XmlDocument();
xDoc.Load(str);
XmlNodeList XMlist = xDoc.SelectNodes("//item"); //在该文档中找到所有的 item
BindDateView.Items.Clear();
foreach (XmlNode Childs in XMlist)
{
ListViewItem child = new ListViewItem(Childs.SelectSingleNode("title").InnerText);
child.SubItems.Add(Childs.SelectSingleNode("pubDate").InnerText);
child.SubItems.Add(Childs.SelectSingleNode("link").InnerText);
BindDateView.Items.Add(child);
}
XmlDocument doc = new XmlDocument();
doc.Load(fileWay);
XmlNode xm = doc.SelectNodes("//head")[Parse].ChildNodes[Child];
string nodeUrl = xm.Attributes[1].Value;
WebRequest request = WebRequest.Create(nodeUrl); //通过rss文档地址建立Web请求对象
WebResponse response = request.GetResponse(); //通过请求对象获得Web响应对象
Stream str = response.GetResponseStream(); //通过Web响应对象获得信息流
XmlDocument xDoc = new XmlDocument();
xDoc.Load(str);
XmlNodeList XMlist = xDoc.SelectNodes("//item"); //在该文档中找到所有的 item
BindDateView.Items.Clear();
foreach (XmlNode Childs in XMlist)
{
ListViewItem child = new ListViewItem(Childs.SelectSingleNode("title").InnerText);
child.SubItems.Add(Childs.SelectSingleNode("pubDate").InnerText);
child.SubItems.Add(Childs.SelectSingleNode("link").InnerText);
BindDateView.Items.Add(child);
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询