Fork me on GitHub

Tutorial 6

E06: Creating a XHTML document from scratch

Finally we go the other way around. We create a new document and fill the content via a projection. (Not that it would not be productive to create a website this way, just a demonstration.)

  • Create a new document from scratch
  • Usage of configuration injection to modify the output transformer.

Projection API

public interface XHTML {
    XHTML setRootNameSpace(String ns);
    XHTML setRootLang(String lang);
    XHTML setTitle(String title);
    XHTML setBody(String body);

Example Code

XHTML xhtml = projector.projectEmptyDocument(XHTML.class);
xhtml.setTitle("This Is My Fine Title");
xhtml.setBody("Here some text...");