This project has retired. For details please refer to its Attic page.
Configure output serializer and doctype as xhtml or html
Apache Forrest
spacer
Font size:      

Configure output serializer and doctype as xhtml or html

The default html output serializer for Dispatcher-based projects is the "xhtml" serializer and the document type declaration is "XHTML 1.0 Strict". That is fine for applications which require xml input. For example, running Forrest as a back-end server and some other tool utilising the forrest output.

However for some websites it would be better to serve plain old html.

To do this, simply add the following line to your project's symbols file. That file is at: PROJECT_HOME/src/documentation/resources/schema/symbols-project-v10.ent

...
<!ENTITY dispatcher-output-serializer "html">
...

and then re-start Forrest.

The output will now be serialized as "html" and the document type declaration will be "HTML 4.01 Transitional".

Note
If your project does not yet have a "symbols file" then follow the FAQ.

To change the document type declaration (perhaps to "Strict"), copy the relevant entities from the main configuration file at $FORREST_HOME/main/webapp/resources/schema/entity/symbols-core-v10.ent to your "symbols file" and over-ride them, i.e.

...
<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01//EN">
<!ENTITY serializer-html-doctype-system "http://www.w3.org/TR/html4/strict.dtd">
...

and then re-start Forrest.

In HTML, the System Identifier is optional, so it can be set to be empty:

...
<!ENTITY serializer-html-doctype-public "-//W3C//DTD HTML 4.01//EN">
<!ENTITY serializer-html-doctype-system "">
...