HTML5替代雅加达ECS(或类似的工具)? [英] html5 alternative to Jakarta ECS (or similar tools)?
问题描述
我想知道是否有针对Java什么好的HTML5生成工具,类似于雅加达ECS项目,其中有长已经退役。我看到有关于通过Java编程生成HTML的问题,但大部分的答案指的是鸵鸟政策完全支持HTML5过时的工具。
i was wondering if there are any good html5 generation tools for Java, similar to the Jakarta ECS project, which has long been retired. I see there are questions regarding programmatic html generation through java, but most of the answers refer to outdated tools that don´t fully support html5.
我指的是特定的这个问题:一个很好的HTML对象的Java模型?
I refer to this question in particular: A good HTML object model in Java?
推荐答案
是的,有一个: Jsoup
jsoup实现的 WHATWG的HTML5 的规范,解析HTML来
同样作为DOM现代的浏览器做的。
jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.
- 刮去并从URL,文件或字符串 HTML解析
- 找到并提取数据,使用DOM遍历或CSS选择器
- 操纵HTML元素,属性和文本
- 对安全白名单干净的用户提交的内容,以prevent XSS攻击
- 输出整齐HTML
- scrape and parse HTML from a URL, file, or string
- find and extract data, using DOM traversal or CSS selectors
- manipulate the HTML elements, attributes, and text
- clean user-submitted content against a safe white-list, to prevent XSS attacks
- output tidy HTML
示例:
的(建立一些HTML)的
Document doc = Document.createShell("");
Element headline = doc.body().appendElement("h1").text("thats a headline");
Element pTag = doc.body().appendElement("p").text("some text ...");
Element span = pTag.prependElement("span").text("That's");
System.out.println(doc);
输出:
<html>
<head></head>
<body>
<h1>thats a headline</h1>
<p><span>That's</span>some text ...</p>
</body>
</html>
文件:
- Codebook
- API Documentation (JavaDoc)
这篇关于HTML5替代雅加达ECS(或类似的工具)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!