Force Domino to output XHTML to allow parsing as XML

In an application I did recently I needed to easily be able to fetch valid XML documents for a lot of documents from the Domino application. This isn’t really a challenge you will say and you’re right… The challenge was that I would like to reuse the HTML that Domino would generate for me for rich text fields etc.

This is a problem since the HTML Domino generates isn’t XHTML so I would get an error when supplying the retrieved page to my JavaScript XML parser. The browser would also complain that the page wasn’t valid XML.

The solution was an undocumented Domino URL argument. When adding the URL argument &OutputFormat=xhtml to the URL Domino will generate valid XHTML and this solved my problem.

Now I could have my cake and eat it too… Now the retrieved page could be supplied to my XML parser and the “embedded” HTML generated by Domino could be extracted and easily shown in a <div> tag using JavaScript. Sweet.

The documents are looked up through a special view using a form formula to make sure the documents are displayed using my special form. The entire form is passthrough HTML and all the contents is wrapped in a CDATA section to be safe.

Using this approach I could reuse the Domino HTML for rich text fields and easily extend the presentation.