简体   繁体   English

使用htmlagility pack + xpath将文本返回为NULL

[英]text returning as NULL using htmlagility pack + xpath

I'm currently playing around with htmlagility pack, however, I don't seem to be getting any data back from the following url: 我目前正在使用htmlagility pack,但是,我似乎没有从以下URL中获取任何数据:

http://cloud.tfl.gov.uk/TrackerNet/LineStatus http://cloud.tfl.gov.uk/TrackerNet/LineStatus

This is the code i'm using: 这是我正在使用的代码:

var url = @"http://cloud.tfl.gov.uk/TrackerNet/LineStatus";
var webGet = new HtmlWeb();
var doc = webGet.Load(url);

However, when I check the contents of 'doc', the text value is set to null. 但是,当我检查'doc'的内容时,文本值设置为null。 I've tried other url's and i'm receiving the HTML used on the site. 我已经尝试过其他网址,并且正在接收该网站上使用的HTML。 Is it just this particular url, or am I doing something wrong. 只是这个特定的网址,还是我做错了什么。 Any help would be appreciated. 任何帮助,将不胜感激。

HtmlAgilityPack是HTML解析器,因此您将无法成功解析非HTML网页,例如您要解析的XML。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM