Need a Java-based HTML prettifier to clean up Velocity-generated HTML

点点圈 提交于 2019-12-05 09:55:19

JTidy has a JTidyFilter. Just define it in web.xml and the respone HTML will be prettified.

PATRY Guillaume

JTidy could be what you're searching for.

I know it's not helping right now, but I think the ideal solution would be for Velocity in first place to support a "better whitespace generation and control" :).

If many users would request and vote such a feature, maybe the Velocity team would include it. Running jTidy or other parsers over the output all the time (e.g. for live requests) consumes quite a few resources, so I'm not sure if it's the best approach especially for dynamic content where caching of that cleaned output doesn't bring much.

ArturoTena

There are many HTML parsers here: Open Source HTML Parsers in Java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!