The presentation of this document has been augmented to identify changes from a previous version. Three kinds of changes are highlighted: new, added text, changed text, and deleted text.

7.3 Instance DataModel Interface

For each model element, the XForms Processor maintains the state in an internal structure called instance data that conforms to the XPath Data Model [XPath 1.0]. XForms Processors that implement DOM must provide DOM access to this instance data via the interface defined below.

Note:

Instance data always has a single root element, and thus corresponds to a DOM Document.

Issue 1: Get the default instance element when no parameter is given to getInstanceDocument()

The IDL for this interface follows:

#include "dom.idl"

pragma prefix "w3c.org"

module xforms {
  interface XFormsModelElement : dom::Element {
    dom::Document getInstanceDocument(in dom::DOMString instanceID)
      raises(dom::DOMException);
    dom::NodeList getInstanceDocuments();
    void rebuild();
    void recalculate();
    void revalidate();
    void refresh();
  };
};

7.3.1 The getInstanceDocument() Method

This method returns a DOM Document that corresponds to the instance data associated with the instance element containing an ID matching the instance-id parameter. If null or the empty string is given, the DOM Document for the default instance of the model is returned. If there is no matching instance data, a DOMException is thrown.

Note:

This is actually not possible with the current spec.!

If the instance document is lazy-authored it will be the default instance, and can thus be retrieved by using no parameter or the empty string.

Issue 2: Make it possible to iterate over all instance documents

7.3.1b The getInstanceDocuments() Method

This method returns a DOM NodeList containing instance data DOM Documents for all instances in the model.

...
Issue 3: Add "shortcut" for getting the instance document directly from the instance element.

7.3b Instance Interface

As for the model element, XForms Processors that implement DOM must also provide DOM access to the instance data directly via the instance element.

The IDL for this interface follows:

#include "dom.idl"

pragma prefix "w3c.org"

module xforms {
  interface XFormsInstanceElement : dom::Element {
    dom::Document getInstanceDocument()
      raises(dom::DOMException);
  };
};

7.3b.1 The getInstanceDocument() Method

This method returns a DOM Document that corresponds to the instance data associated with the instance element. If there is no instance data, a DOMException is thrown.

...
Issue 4: Make it possible to get from an instance data node to the instance element in the form.

7.3c instanceOwner getFeature method call

is it evident that null will be returned if not called on an instance data node?

The XForms Processor must also provide support for the [DOM3 Core] DOMNode interface getFeature method call "org.w3c.xforms.instanceOwner" with the version string "1.0". This method will return the DOM Element representing the instance element an instance data node belongs to.