如何使用PHP / ASP.NET解析HTML? [英] How to parse an HTML with PHP/ASP.NET?

查看:141
本文介绍了如何使用PHP / ASP.NET解析HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题不在于解析HTML,而是解析HTML并根据HTML标记向DOM添加元素。
例如 - 我希望能够获取HTML页面,为HTML标记添加属性 - 例如class ='replace',在页面中放置一些PHP / ASPNET代码(使ASPX页面与ASPNET或将某些包含在PHP中),并使其在每次访问时都解析页面,并操作标记为class =replace的标记的DOM。
例如,如果我有< div class ='replace'>< / div>,在我运行脚本后,我会得到类似于< div class ='replace'>这是一个新的文本< / div>

The question is not really about parsing the HTML, but rather parsing the HTML and adding elements to the DOM according to the HTML tags. For example - I want to be able to take an HTML page, add attribute to the HTML tags - such as "class='replace'", put some PHP/ASPNET code in the page (make an ASPX page with ASPNET or put some include with PHP) and make them parse the page every time it is accessed and manipulate the DOM of the tags marked as 'class="replace". For example if I have < div class='replace'>< /div>, after I run the script I'll get something like < div class='replace'>This is a new text< /div>

感谢,
Roman

Thanks, Roman

推荐答案

用于 PHP 的HTML解析器,以及一个用于。NET

HTML parser for PHP, and one for .NET.

这篇关于如何使用PHP / ASP.NET解析HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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