XML data binding refers to a means of representing information in an XML document as a business object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM or SAX to retrieve the data from a direct representation of the XML itself.
An XML data binder accomplishes this by automatically creating a mapping between elements of the XML schema of the document we wish to bind and members of a class to be represented in memory.
When this process is applied to convert an XML document to an object, it is called unmarshalling. The reverse process, to serialize an object as XML, is called marshalling.
Since XML is inherently sequential and objects are (usually) not, XML data binding mappings often have difficulty preserving all the information in an XML document. Specifically, information like comments, XML entity references, and sibling order may fail to be preserved in the object representation created by the binding application. This is not always the case; sufficiently complex data binders are capable of preserving 100% of the information in an XML document.
Data binding is a general technique that binds data sources from the provider and consumer together and synchronizes them. This is usually done with two data/information sources with different languages as in XML data binding. In UI data binding data and information objects of the same language but different logic function are bound together (e.g. Java UI elements to Java objects).
In a data binding process, each data change is reflected automatically by the elements that are bound to the data. The term data binding is also used in cases where an outer representation of data in an element changes, and the underlying data is automatically updated to reflect this change. As an example, a change in a TextBox
element could modify the underlying data value.