To JAXB or not to JAXB
I really like JAXB. If you have to work with xml it makes the marriage of Java and xml a lot easier.. there are some quirks in how the data structures are formed and sometimes it creates an awkward chain of object but that really flows out of how xml is structured.
That said.. there is something that really bothers me about using JAXB. It appears that the ease of JAXB is a little, well.. too handy.
How's that you ask? Well.. when programmers add a compilation of an xml schema to the build file just to have the ability of easily creating an xml document in one utility class.. well that's really a problem. I mean come on.. it's not that hard to create xml in Java, is it? Is it really necessary to generate 30+ datastructures (with every build nonetheless.. what is up with that, not like the schema changes often since it's not even ours) then only use three of them just to avoid writing a few lines of Java? Especially since this is only used in one SOAP call?
So that's what bothers me most about JAXB.. at least today. It's too freaking easy to abuse. Of course, I still wouldn't exchange it for the "old way" of doing large quantities of xml in Java for the world.. but really, it shouldn't be used just because you can.
Comments
Agree completely.. If you want quick n dirty XML, might want to suggest Commons digester to your colleague.
Posted by: matt | January 26, 2006 09:00 PM