如何从XML文件读取值 [英] How to Read value From XML file

查看:76
本文介绍了如何从XML文件读取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



以下是我的xml文件.

Hi,

Below is my xml file.

<Programme id="000115671767" title="Have A Laugh : Donald&amp;apos;s Tire Trouble">
      <Period end="2012-11-05T19:40:00Z" start="2012-11-05T19:30:00Z" />
      <EpgDescription locale="hi_IN">
        <EpgElement key="Title">Have A Laugh : Donald&amp;apos;s Tire Trouble</EpgElement>
        <EpgElement key="Short_Description">Come join your favourite Disney characters for some fun and laughter.</EpgElement>
        <EpgElement key="Description">Come join your favourite Disney characters for some fun and laughter.</EpgElement>
      </EpgDescription>
      <EpgDescription locale="en_GB">
        <EpgElement key="Title">Have A Laugh : Donald&amp;apos;s Tire Trouble</EpgElement>
        <EpgElement key="Short_Description">Come join your favourite Disney characters for some fun and laughter.</EpgElement>
        <EpgElement key="Description">Come join your favourite Disney characters for some fun and laughter.</EpgElement>
      </EpgDescription>
    </Programme>




我想从EpgElement节点(突出显示)中读取值,并想使用linq将其存储在asp.net中的3个不同变量中.
有人告诉我如何在linq中做到这一点吗?

提前谢谢.

Ranjeet




I want to read the value from EpgElement node (Highlighted) and want to store in 3 different variable in asp.net using linq.

Is anyone tell me how to do that in linq.

Thanks in advance.

Ranjeet

推荐答案

您需要以下内容:
http://msdn.microsoft.com/en-us/library/bb387098.aspx [ ^ ],
http://msdn.microsoft.com/en-us/library/system. xml.linq.xdocument.aspx [ ^ ].

此CodeProject文章也可能有用:通过XMLDocument和XDocument解析XML文档 [ ^ ].

—SA
You need this:
http://msdn.microsoft.com/en-us/library/bb387098.aspx[^],
http://msdn.microsoft.com/en-us/library/system.xml.linq.xdocument.aspx[^].

This CodeProject article can also be useful: Parse XML Documents by XMLDocument and XDocument[^].

—SA


这篇关于如何从XML文件读取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆