Chapter 15. Data Binding

I’ve tried to run the gamut in what I’ve covered so far, and even in the order that I’ve covered it. When I started talking about Java in Chapter 2, you had complete control. SAX provided the thinnest of veneers over XML, and basically provided a framework with which to write lots of callbacks. When I moved to DOM and JDOM, you got quite a bit more help, albeit with some loss of power. These tree-based, in-memory models were more convenient, although you had to pay a small price in terms of performance. Moving on to JAXP, you were placed higher up the chain of command, but gained another level of abstraction. At that point, you still had some control, but were working strictly in XML.

Then I shifted gears, and we looked at web publishing frameworks, XML-RPC, SOAP, and business-to-business and web services. This was a far cry from the down-and-dirty approach taken in the first half of the book. While you had immensely more convenience and specialization, you lost a lot of control over how XML was handled, and sometimes didn’t see XML at all (like in XML-RPC). This may have left you (as it left me) missing getting your hands dirty a bit. You can’t make the subtle tweaks in an XML document’s values when working with SOAP, for example, that you could when using SAX or JDOM. However, the convenience of WSDL was nice, and had advantages over typing an element’s name wrong in DOM. In short, it left me wishing for a happy medium.

Data binding provides that medium, ...

Get Java and XML, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.