如何在Java中解析和修改HTML文件 [英] How to parse and modify HTML file in Java

查看:637
本文介绍了如何在Java中解析和修改HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,其中我需要阅读HTML文件并标识特定标签,修改标签的内容并创建新的HTML文件.是否有一个可以解析HTML标签并能够将标签写回到新文件的库?

I am doing a project wherein I need to read an HTML file and identify specific tags, modify the contents of the tag, and create a new HTML file. Is there a library that parses HTML tags and is capable of writing the tags back to a new file?

推荐答案


如果要修改网页并返回修改后的内容,最好的方法是使用XSL转换.
http://en.wikipedia.org/wiki/XSLT


if you want to modify web page and return modified content, I thnk the best way is to use XSL transformation.
http://en.wikipedia.org/wiki/XSLT

这篇关于如何在Java中解析和修改HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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