Example usage for org.jdom2 DocType DocType

List of usage examples for org.jdom2 DocType DocType

Introduction

In this page you can find the example usage for org.jdom2 DocType DocType.

Prototype

public DocType(String elementName, String systemID) 

Source Link

Document

This will create the DocType with the specified element name and reference to an external DTD.

Usage

From source file:com.cybernostics.jsp2thymeleaf.JSP2Thymeleaf.java

private List<Content> rootContentFor(JspTree jspTree) {
    List<Content> contents = new ArrayList<>();
    if (showBanner) {
        contents.add(new Comment("Created with JSP2Thymeleaf"));
        contents.add(new Text(NEWLINE));
    }// www.j a v  a 2  s.c om
    contents.addAll(contentFor(jspTree, this));

    final Optional<Content> foundHtmlElement = contents.stream().filter(JSP2Thymeleaf::isHtmlElement)
            .findFirst();

    if (foundHtmlElement.isPresent()) {
        final Element htmlElement = (Element) foundHtmlElement.get();
        contents.remove(htmlElement);
        trimTrailingWhitespace(contents);
        htmlElement.addContent(contents);
        htmlElement.setNamespace(xmlns);
        ActiveNamespaces.get().forEach(ns -> htmlElement.addNamespaceDeclaration(ns));
        return Arrays.asList(new DocType("html", THYMELEAF_DTD), htmlElement);
    } else {
        Element thFragment = createFragmentDef(contents);
        return Arrays.asList(new DocType("html", THYMELEAF_DTD), thFragment);
    }

}