Wednesday, August 24, 2005

Apache XML verses Sun Java XML

Apache XML technologies, xml.apache.org, are implemented in Java, (though many API also support C++ and Perl). Sun Java XML API, also have a catchment of XML technologies. What are the differences and similarities in their approaches? Which is better?

Basically, both XML Apache and Sun Java agree upon and acknowledge the XML standards like XSD, XPATH, SOAP, WSDL to name a few. Also they agree upon the core XML API like SAX and DOM. Sun proclaims that there are three ways to parse XML SAX, DOM and Streams. XML over streams are implicitly acknowledged by XML Apache. There have also been cross contributions between Sun Java and XML Apache. The Java XML core API, reference implementation provided by Sun in JDK 1.5 is that of Apache Xerces. Also Apache Axis figured in Sun's Java Web Services Toolkit.

Some of the API and packages do conflict, like that of ApacheXML Beans with JAXB. Apache claims that it fully implements XSD , at the same time, it criticizes JAXB for not fully supporting XSD (XML Schema). Sun Java acknowledges in its documentation that JAXB partially supports XSD.

The reason for this partial XSD support in Sun Java; provides an insight into the differences in their respective design philosophies.

For Sun Java objects are the prime focus whereas Apache views XML as prime.

In Sun's philosophy you think in Java, and use XML for persisting Java Objects for storage and inter process communications.

Whereas, Apache's philosophy is to think in XML and use Java as an underlying implementation components. Thus lies the basic reason for the differences in their approaches.

I will not judge as to which of the two approaches are better, since I use both depending on which model fits the problem at hand the best. Languages are structural models for channeling the though process. Some languages have edge over the others in a given problem domain for providing a range of solutions.

Use either of the model that suits you and you feel at ease with, while modeling a solution to a given problem.

Ashish Banerjee (www.Ashish.Banerjee.name)