XML data binding
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

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

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:

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

I bet you can imagine some much better pagination examples.
At the end your ‘bookstore’ will look like this:

I have included a working example here.
Navigation-menu from view (XML Transformation)
In a previous writing I explained how you can create a navigation-menu that collects it’s information straight from a Notes View.
Using the ?ReadViewEntries URL command Notes outputs the view data in XML form which can be the source of a transformation to HTML using the XSLTProcessor in your browser.
When the project became actual again I found some time to improve it’s functionality, since it was not working 100% in Firefox. So here is an example available for downloading.
Here is short summary of the example’s features:
- the navigator collects it’s source data from a Notes view using the ReadViewEntries command
- when navigating through the menu for each subcategory (via the + and - icons) a new AJAX request is done to collect the information withing that (sub)category (so the amount of data is being divided into smaller parts)
- the information is being transformed into HTML via the build XSLTransformator of the browser
- when clicking on (sub)category a collection of responding documents is collected and presented in another frame
- the navigator also contains document links which will load the document info in the right frame when clicked
- documents can be grouped under whatever structure in the View
Very nice, I did not manage to solve 1 thing yet: if a (sub)category contains subcategories AND documents, the documents are being displayed FIRST. I rather would display the subcategories first and then the documents. Maybe you can help me with that one?
