XForms uses XPath to address data. This is called binding.
XForms uses two sections to define data: The XForms model and the XForms user interface.
The XForms model is an XML template (instance) for the data, and the XForms user interface is a
description of the input and display of the data.
XForms uses XPath to define the connection between the two sections. This is called
XPath is a W3C standard syntax for defining parts of XML documents.
XPath uses path expressions to identify nodes in an XML document. These path expressions look
much like the expressions you see when you work with a computer file system.
This XPath expression:
addresses the fname node in the XML document:
With an XForms model instance like this:
The XForms user interface can bind <input> elements using the ref attribute:
The ref="name/fname" attribute in the example above is an XPath expression pointing to
the <fname> element in the instance model. This binds the input field to the <fname>
element in the XML document (instance) that is collecting data from the form.
The XForms user interface could also use a reference like this:
In the example above, the slash (/) at the beginning of the XPath expression indicates the root
of the XML document.
The XForms user interface can bind <input> elements using the bind attribute:
Why two different ways to bind input control elements to instance data?
Well, when you start using XForms in complex applications, you will find binding using bind to be
a more flexible way to deal with multiple forms and multiple instance models.
Your Query was successfully sent!