Manipulating instance data with script

XForms provides the getInstanceDocument method to allow access to instance data within a model. An example of its use is here.