HTML敏捷提取PHP标签 [英] HTML Agility to extract PHP tags

查看:141
本文介绍了HTML敏捷提取PHP标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么语法应该与HTML敏捷性包被用来提取所有

这是一个PHP文件..?



<$ P $标签p> HtmlNodeCollection标签= htmlDoc.DocumentNode.SelectNodes(//?PHP的);



抛出一个异常(无效标记)。



试过逃跑?与??和\?



感谢


解决方案

HTML敏捷性包不呛在名称以节点。最简单的方法可能是通过HTML字符串将其加载到文档对象之前和替换<的实例; < PHP 等上。这并不处理任何案件讨厌就像有一个字符串在页面上用文字与&为lt但实际上,往往是如何发生的呢?


What syntax should be used with HTML Agility Pack to extract all

Tags from a Php file..?

HtmlNodeCollection tags = htmlDoc.DocumentNode.SelectNodes("//??php");

Throws an exception (invalid token).

Tried escaping ? with ?? and \?

Thanks

解决方案

HTML Agility Pack does choke on nodes with ? in the name. The simplest option is probably to go through the HTML string before you load it into a document object and replace instances of <? with <php and so-on. That doesn't handle any nasty cases like having a string literal on the page with "&lt?" but really, how often does that happen?

这篇关于HTML敏捷提取PHP标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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