doumaogui5937
doumaogui5937
采纳率100%
2010-01-27 11:59 阅读 44

如何使用PHP / ASP.NET解析HTML?

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>

Thanks, Roman

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    dpo60833 dpo60833 2010-01-27 12:16

    HTML parser for PHP, and one for .NET.

    点赞 评论 复制链接分享
  • douzi2333 douzi2333 2010-01-27 14:10

    See

    in PHP, how to remove specific class from html tag?

    For complex and simple solutions in PHP using DOM parser object or preg_replace.

    C.

    点赞 评论 复制链接分享

相关推荐