HTML5

You can use mixer2 with html5. You write template with xml syntax.

Hello World (html5 version)

template:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
</head>
<body>
    <article>
        <section>
            <h1>headline</h1>
            <p id="hellomsg">here comes hello message</p>
        </section>
    </article>
</body>
<html>

java code:

import java.io.File;
import org.mixer2.Mixer2Engine;
import org.mixer2.jaxb.xhtml.P;
import org.mixer2.jaxb.xhtml.Html;

public class HelloWorld {

    public static void main(String[] args) throws Exception {
        Mixer2Engine m2e = new Mixer2Engine();
        Html html = m2e.loadHtmlTemplate(new File("HelloWorld.html"));
        html.getById("hellomsg", P.class).replaceInner("Hello World !");
        System.out.println(m2e.saveToString(html));
    }

}

result

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"/>
</head>
<body>
    <article>
        <section>
            <h1>headline</h1>
            <p id="hellomsg">Hello World !</p>
        </section>
    </article>
</body>
</html>

html5 with xml syntax

For example, you have to write <br /> rather than <br>. Also you should care property.

NG <input type="email" required> 
<input type="checkbox" checked>
OK <input type="email" required="required" /> 
<input type="checkbox" checked="checked" />
Input checkbox = html.getById("fooCheck", Input.class);
checkbox.setChecked("checked");
// You get <input type="checkbox" checked="checked" />

data-*, aria-* property

In html5, you can write any property start with date-* or aria-* at all tags.

import static org.mixer2.xhtml.TagCreator.*;

Div div = div();
div.setData("foo", "bar");
// you get <div data-foo="bar"></div>
// html template: <div id="fooid" data-foo="bar">abc...</div>
String foo = html.getById("fooid", Div.class).getData("foo");
// String variable "foo" has "bar".

By the same token, you can use getAria() and setAria() method.