how to manage node identity across client and server
Problem
A central problem for the implementation of a new forms facility is the exchange of state information for certain nodes.
The model keeps a state object for each node in all instances of a form. This determines the value, readonliness, requiredness, validity, datatype and relevance of a bound node. This state information needs to be transferred to the client for consumption.
However to allow offline capabilities the client itself should be able to mutate the data set to e.g. change values, insert nodes and delete nodes.
To synchronize the changes back to the server we need an identity to access the respective nodes.
Possible Approaches
normalized XPath locationpathes
e.g. /foo[1]/bar[1]/baz[3]
Can easily be calculated for each node and identify a position in a piece of XML. However insert and deletes then cause update issues.
plain ids
We could generate an id for each node we got in the XML. To avoid adding an attribute that did not exist in the original XML or even conflicts with it the id could be 'hidden' in a DOM user object.
node numbering or internal eXist-db node id
The internal node numbering algorithm might help also as it has potential answers to the problem of inserts.
Investigate with @wolfgang in a nearby telco...