All about Lotus Domino Development (AaLDD)

XML data binding

Posted in Show N Tell Thursday, XML, lotus Domino, sntt by quintessens on May 8th, 2008

According to Wikipedia refers XML data binding to the process of representing the information in an XML document as an object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM to retrieve the data from a direct representation of the XML itself.

In other words you could tie HTML tables to Notes data and navigate through it without reloading the page.

For this SNTT demo I needed:

  • a form to create Book documents with
  • a view to present the books documents as XML
  • a page on which I define an HTML table and connect the table to the XML view in order to give it content
  • (a $$ViewTemplate for the Xml view)

First step:

  • Create your Notes form with some fields. I choose Title, Author, ISBN and Price.
  • Create a set of documents with this form.

Next:

  • Create a view that presents the ‘Books’ documents as XML data.
  • On the fifth tab under ‘Web access’ d not forget to set the option ‘Treat view contents as HTML’
  • The view must start with an opener and closing tag for each document
  • For each column you define sub child elements

xml view

  • Setup a $$ViewTemplate for this View in order to be able to add a root element:

$$ViewTemplate form

Reminder: do not forget to set the content-type for this Form as HTML.

Continue:

  • Create a Form/Page that will hold the HTML Table.
  • Add the following HTML on it:

HTML for table

As you can see the Table is linked to a datasource, in this case the View books.xml. Each TD in the TBody part is linked to a datafield. In this setup the datapagesize is set to 5, meaning 5 documents at a time will be displayed.

Some extras

By giving the table an ID (xmlTBL) you can add functions to navigate through the table such as:

  • previous / next set of documents
  • first / last set of documents

navigation buttons

I bet you can imagine some much better pagination examples.

At the end your ‘bookstore’ will look like this:

how the local bookstore looks like

I have included a working example here.

2 Responses to 'XML data binding'

Subscribe to comments with RSS or TrackBack to 'XML data binding'.

  1. Henning Heinz said, on May 8th, 2008 at 9:45 am

    Thank you for your example. While I asked myself why I have not used this before it came to my mind that this is probably still an IE only approach.

  2. quintessens said, on May 8th, 2008 at 12:20 pm

    yes XML data islands are a feature of IE

Leave a Reply