How can i parse html file in windows phone 7?

点点圈 提交于 2019-12-25 07:22:00

问题


Hi am using xml file given below,i want to parse html file .

<Description>
 <Fullcontent>
   <div id="container" class="cf">
    <link rel="stylesheet" href="http://dev2.mercuryminds.com/imageslider/css/demo.css" type="text/css" media="screen" />
        <ul class="slides">
            <li>Sonam Kapoor<img src="http://deys.jpeg"/></li>
            <li>Amithab<img src="http://deysAmithab.jpeg"/></li>
            <li>sridevi<img src="http://deyssridevi.jpeg"/></li>
            <li>anil-kapoor<img src="http://deysanil-kapoor.jpeg"/></li>
         </ul>
    </div>
  </Fullcontent>
</Description>

i want bind image with name


回答1:


You can install HtmlAgilityPack from NuGet (just search for agility). Parsing is also simple. Here is way for selecting image tags and taking source attributes:

HtmlDocument html = new HtmlDocument();
html.Load(path_to_file);
var urls = html.DocumentNode.SelectNodes("//ul[@class='slides']/li/img")
                            .Select(node => node.Attributes["src"].Value);

Btw looks like direct selection of attributes is not supported yet.



来源:https://stackoverflow.com/questions/15338089/how-can-i-parse-html-file-in-windows-phone-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!