XML for business rather than technology
With the increasing popularity of XML, more and more people pay more attention to usability. In other words, programmers and managers do not want to think of XML as a technology, have their own semantic and lexical structure, and feel that it is more like pure data, access without worrying about the details of the XML data format.
The simplest way to complete the transformation of XML from technology to business format is data binding, which remains to be argued. Data binding is the use of the Application programming interface (application programming Interface,api) to manipulate the data in an XML document so that the programmer does not have to know too much about XML, do not have to use angle brackets, or consider CDATA parts or entities Quotes and stuff like that. But even with data binding, you'll find that there are a number of options and important issues that need to be considered carefully before proceeding.
For the purposes of this article, I'll cover two basic issues related to data binding:
A method of representing data through the data binding API.
The use of data when it is treated as business data.
Represents XML Data
In the most common case, data binding is the transformation of data in an XML document into an object in the programming language being used.
Object-based APIs for data binding
For example, look at the following XML code:
<person>
<firstName>Brett</firstName>
<lastName>McLaughlin</lastName>
<email>brett@newInstance.com</email>
</person>
We can turn this code into objects, for example in Java™ code, which is an instance of the person class, with member variables FirstName, lastName, and email. The instance should contain the data in the code snippet, and it can be accessed by means of a method call, such as the Myperson.getfirstname () method.
A document-based API for data binding
Although this is the most common method of data binding, an API that uses an XML document and represents an entire document as an object is also a form of data binding. These APIs include the Document Object model (Doc object model,dom), JDOM, and dom4j, all of which are used to create an object model of an XML document in Java encoding.
In these models, we use calls like Rootelement.getchild ("FirstName"). GetValue () (or similar calls, depending on the details of the API). While this does require some basic knowledge of XML (understanding what elements are and the basic structure of the document), the programmer abstracts the details of parsing. This is the nature of data binding: the ability to pay more attention to data than the format of data display.
Programmers more relaxed (a bit)
Once a more common data-binding solution, such as Sun's JAXB, is adopted, there will be less underlying XML syntax to be aware of. You can really completely use Java (or your preferred programming language) objects, methods, and variables. Even the details of the element and the document structure are hidden beneath the object created by the data-binding process.
However, the key here is (often not considered) the need to match XML data structures to objects in the system, or to create objects in the system that match the XML data format used. Both of these situations are less obvious than the mapping of XML, but it is still part of the process.