Javaton

Tuesday, April 18, 2006

spring-oxm - Why do we have to use another abstraction layer?

Java is known for its wealth of options when it comes to choose an API to manipulate XML, and XML Schema.

This wealth is both a bless and a curse. For sure, it is very good to have many options to choose from, since each API - JDOM, DOM4J, Xerces, JAXB, XMLBeans, Castor, Jixb, Aegis and many more – has its own merits and drawbacks.

But at the same time, this plethora is a nightmare for the one who has to take the decision which to choose.

Hopefully, to the rescue, comes a new API developed under the umbrella of spring framework the spring-oxm.

Spring Object-to-XML is a very small library that acts as a mediate between your program and the code that actually manipulates XML using a particular API.

Someone could argue “Why do we have to use another abstraction layer?”. Actually, you don’t have. Yet again, spring-oxm offers the same benefits as spring-dao, or commons-logging offer:

  • Independence from actual implementation. Your main code establishes a contract with spring-oxm and not any particular XML API
  • Ease to compare different implementation. Write your tests against spring-oxm, and just provide two different implementations.
  • Low risk choice. Are you disappointed by one XML API? Go ahead a choose another. The rest of your application does not have to change.

Just to summarize, if you are confused about which XML API to choose adopt spring-oxm to minimize your headaches. You can find introductory material here.

0 Comments:

Post a Comment

<< Home