Building up an XML document over a number of pages


The scenario is:

We have a web application that has 5 pages to be filled in. What we want to do is to build an XML document as the user moves from page to page; as the user moves from page 1 to page 2, we want to save the data from page 1 into tamino, then as the user moves to page 3 from page 2, save the data from page 2 to tamino, etc, the idea is that the user may stop after page 2, and his work to that point is already saved away to be retrieved. A very real scenario is where he gets to page 3 and realises that he does not have some piece of information. It would be very irritating to have to go and reenter everything at some later point once he has that information.

The question is; what is the best method of building the xml document up for this scenario? Ideally, given that persistence is one of the chief aims, this should occur on Tamino directly and not be built up outside Tamino and posted as one unit.


Stuart King

I would do it this way:

Using a webapp framework like e.g. Struts I’d just do as you say and save the XML document after each page of input.

Going through the pages, the user input would refine the DOM model of the document I hold perhaps in a session object. On submitting the page, the current state of the DOM is stored in Tamino.

If the user stops the editing process and comes back later, I’d retrieve the work in progress document from Tamino, place its DOM representation in the session and set up the next input page for the user … and so on…

Key feature of Tamino to store “half-ready” content is “closed content” set to no, so any nearly-valid XML instance can be stored.

How’d you commence?

Best regards, Andreas