GetInnerTextForHtmlTags没有返回任何值

时间:2013-03-07 10:32:08

标签: c# .net-4.0 html-parsing

我正在尝试使用HTML Parser来获取特定标记内的文本,例如标题标签。

在.Net 4.0中并在Web应用程序中使用命名空间Microsoft.VisualStudio.TestTools.WebTesting我将此代码添加到页面加载方法中

HtmlTagInnerTextParser myParser = new HtmlTagInnerTextParser("D://myProfile.html");
    foreach (HtmlTagInnerText innerTextTag in
                        myParser.GetInnerTextForHtmlTags("title", true, false, false))
        Label1.Text += innerTextTag;

但它没有返回任何价值。 这里有什么错误?

注意:这是头部,顺便说一下,这是我在Linkedin.com上的个人资料

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta name="description" content="View Noor Orfahly's professional profile on LinkedIn. LinkedIn is the world's largest business network, helping professionals like Noor Orfahly discover inside connections to recommended job candidates, industry experts, and business partners.">
<meta name="pageImpressionID" content="a37f57a0-32a0-4eec-878f-dc93e6061f58">
<meta name="pageKey" content="nprofile-public-success">
<meta name="analyticsURL" content="/analytics/noauthtracker">
<link rel="shortcut icon" type="image/ico"  href="http://s.c.lnkd.licdn.com/scds/common/u/img/favicon_v3.ico">
<link rel="apple-touch-icon-precomposed" href="/img/icon/apple-touch-icon.png">
<link rel="stylesheet" type="text/css" href="http://s.c.lnkd.licdn.com/scds/concat/common/css?h=3bifs78lai5i0ndyj1ew7316e-cb0h51b0j26n3h3dj1gg0j3s5-c5839km74lqu75dnankln5rgt-4uu2pkz5u0jch61r2nhpyyrn8-ee859529mdos6retehcmn9z8a-7poavrvxlvh0irzkbnoyoginp-aaf05uhqqum64rj28yk7u5pwu-3t9ar1pajet97hzt9uou74qbb-ct4kfyj4tquup0bvqhttvymms-9zbbsrdszts09by60it4vuo3q-ctk5sq3qm6xkani92un2rss8o-8ti9u6z5f55pestwbmte40d9-anh0kob2i3lfqyuekf39o0bp9-cv4cvfq8dxxwejkd2x9u08g9y-2pkp5ymkf2bt6pt2kpsxpw717&amp;fc=2">
      
<script type="text/javascript">
//InSlow namespace
if(!InSlow || typeof(InSlow) === 'undefined' ) var InSlow = {};
InSlow.scriptUrl =               
            ["http://s.c.lnkd.licdn.com/scds/concat/common/js?h=avzk7itghu69mbjdafj6tlzx3&fc=2"]  
[0];
</script>
<title>Noor Orfahly | LinkedIn</title>
<link rel="stylesheet" type="text/css"  href="http://s.c.lnkd.licdn.com/scds/concat/common/css?h=ovohvnpd6tlg355ty7nufasp-37p30stqzhhpyj4p81s2nf0kz-8oorki02vtv3w5iwgyvrjji9i-5xxmkfcm1ny97biv0pwj7ch69-57pxkwsjxxcohoela6qmfq4kh&amp;fc=2">
 <script type="text/javascript" src="http://s.c.lnkd.licdn.com/scds/concat/common/js?h=7nhn6ycbvnz80dydsu88wbuk-1kjdwxpxv0c3z97afuz9dlr9g-dlsf699o6xkxgppoxivctlunb-8v6o0480wy5u6j7f3sh92hzxo-ceozrdkylbn5rhlzqyo8mun0x&amp;fc=2"></script>
 </head>'

0 个答案:

没有答案