HtmlFlow version 2.0 has full support for all existing HTML5 elements and
Moreover all attributes are strongly typed with enumerated types which
restrict accepted values.
Now HtmlFlow API is constructed with the support of an automated
framework xmlet based on an
XSD definition of the HTML5
syntax and rules.
Thus we remove the package
which have been replaced by the types defined in
This new approach forces HtmlFlow API to keep consistency along all methods use.
So version 2.0 introduces some changes, namely:
All fluent methods have no parameters. For example, formerly when we were specifying the text node of a paragraph or heading (such as,
.h2("my title")), now we have to chain an invocation to the
text()method (such as,
All fluent methods now return the created element. Whenever we need to proceed with the parent element we may chain an invocation to
.º(). For example, formerly when we wrote
.div().br().p()now we have to write
.div().br().º().p(). Moreover the statement
.div().br().p()not even compiles, because HTML does not allow a paragraph inside a break line element, so we will get a compilation error.
.text()which does not create an element but a text node instead, the rest of fluent methods return the created element. For
.text()it returns the element containing the text node (the
The new method
º()returns the parent of an element. This method is strongly typed so it returns exactly an instance of
Tis the concrete class which extends
Element. This is an important issue to respect the HTML structure and rules.
Indentation. Now every element or text node is printed in a new line. Formerly there were some exceptions, namely for text nodes which were printed in the same line of the beginning tag. These exceptions were removed.
If you do not like the HtmlFlow print approach you are free to implement your own
org.xmlet.htmlapi.ElementVisitor. See the
htmlflow.HtmlVisitorimplementation as a guideline.
Removed default implementation of method