XML and Java technology: Data binding in 1,000 varieties
|
|
|
|
| Articles Reviews XML | |
| Written by Brett D. McLaughlin, Sr. | |
| Tuesday, 13 March 2007 | |
|
{mos_sb_discuss:24}
This article doesn't present a solution, instead Brett introduces some discussion topics to start you thinking about how you use XML and data binding. You're encouraged to share your thoughts with others on the XML and Java technology discussion forum. XML for business rather than technology As XML has become increasingly popular, more and more emphasis is put on usability. In other words, programmers and managers want to treat XML less as a technology, with all its own semantics and lexical constructs, and more like pure data, accessed without having to worry much about the specifics of the XML data format. Arguably the easiest way to achieve this move from using XML as a technology to a business format is data binding. Data binding is when the data in an XML document is manipulated using an Application Programming Interface (API) that doesn't force the programmer to know much about XML, work with angle brackets, or think about things like CDATA sections or entity references. But even when it comes to data binding, you'll find lots of options, and plenty of important issues to think closely about before you charge ahead. For the purposes of this discussion, I'll take on two basic issues related to data binding:
In the most generic case, data binding means that the data in an XML document is turned into an object in the programming language being used. Object-based APIs for data binding For example, take the following XML fragment: You might turn this into an object, say in Java™ code, that is an instance of a Document-based APIs for data binding While that's the most common approach to data binding, APIs that take an XML document and represent the entire document as an object are also a form of data binding. These APIs include the Document Object Model (DOM), JDOM, and dom4j, all of which create an object model of an XML document in Java coding. In these models, you'd make calls like Easier for the programmer (sort of) Once you move to a more common data binding solution, like Sun's
JAXB, you have even less underlying XML syntax to worry about. You
really can work entirely with Java (or your favorite programming
language) objects and methods and variables. Even details about
elements and the structure of the document become hidden in the objects
created by the data binding process.
The key here, though -- and what is often not thought about -- is
that you still have to either match your XML data structure to objects
in your system, or create objects in your system that match the format
of XML data that you work with. In both cases, the mapping to XML is a
little less obvious, but it's still a part of the process. Powered by jReviews |
|
| Last Updated ( Sunday, 08 July 2007 ) | |
| < Prev | Next > |
|---|







