Exploring Where XML and Java Meet
For some users, the Java and XML roads come together in a smooth interchange where objects can be serialized as XML and schemas cleanly bound into classes. But for others, they come together in a maze of alternative sidestreets, and there are a lot of interesting things happening there that one one misses by simply taking the "databinding interchange." The overall theme of this weblog is to explore some of the sidestreets in the "place" where XML, Java, and related technologies such as DBMS and Web services meet, and sometimes look into the dark alleys leading off them. I plan to use this weblog as a forum in which to point to interesting ideas and generate discussions about them, so please contribute thoughts, corrections, commentary, and suggestions.
To start things off, there has been a spate of articles lately related to something I've wondered about for a long time, namely the relationship of the world of objects to the world of XML. On one hand, the OO principle of "data hiding" suggests treating the details of data formats as implementation details to be hidden behind access methods -- relates to the world of XML. The whole point of XML is to expose the data rather than to hide it. Norm Walsh emphasizes the point that "XML is Not Object Oriented," pointing out that:
the constituent elements and attributes of an XML vocabulary are not generally related to each other by inheritance, nor do they naturally correspond to objects with any kind of precision.
On the other hand, XML makes an awfully handy serialization format for Java objects.Also, there is a generic XML object model that has much support in the Java world and provides a useful, if very low-level, set of methods for working with XML documents.
So, as the old joke goes, XML really is a bit of a "floor wax and a dessert topping." The trick is to know which approaches, tools, APIs, etc. are best for which applications. That is a subject we will explore in subsequent editions of this weblog.