Allow custom output format (not Writer)
Currently, the last processor in the chain writes the result to the Writer.
It would be nice if it was possible to instead get the raw DOM, if the output is not a Writer/String.
Hi, I have been asked to comment on this issue via CodeTriage.
The template is processed by building an internal in-memory model of the template processing result. This model is built and written dynamically using event queues for gathering a sequence of template events into a Model object representing the result.
Please have a look at the comments in the TemplateEngine class in Thymeleaf 3.0 and above:
"In order to execute templates, the different process(...) methods should be used. Those are mostly divided into two blocks: those that return the template processing result as a String, and those that receive a Writer as an argument and use it for writing the result instead. Without a writer, the processing result will be returned as a String: By specifying a writer, we can avoid the creation of a String containing the whole processing result by writing this result into the output stream as soon as it is produced from the processed template".
Currently a FastStringWriter from org.thymeleaf.util is used as a default writer.