0
我在寻找某种现成的Java库的验证和获取有关信息的内置HTML标签和属性如下所示:的Java:验证和获取有关HTML标签信息/属性
public class MyHTMLGenerator {
/**
* Accepts tag name and attributes and returns a string containing HTML
* element.
*/
public String createElement(
String tagName, Map<String, String> tagAttributes) throws Exception {
HTMLUtils utils = HTMLUtils.for(HTMLDialects.HTML_5);
HTMLTagInfo tagInfo = utils.getTagInfo(tagName);
...
// checking that tag name specified is a valid HTML5 tag name
// checking that tag attributes' names and values are valid for this tag
// does this tag is paired or not? which one to return:
// "<p>" or "<p></p>"?
// etc.
...
return result;
}
}