Re: annotations-based XML parsing for java?
Paul Libbrecht <[email protected]>
| Newsgroups | gmane.text.xml.general |
|---|---|
| Message-ID | <[email protected]> |
Elliotte Harold wrote: > According to the site, "MOX only works if you know the structure of > the XML beforehand. However, unless you are writing some sort of XML > editor, this is virtually always the case." I respectfully disagree, I > routinely write code for systems the full structure of which is only > determined reflectively at runtime. I even more commonly write code > where the structure is only somewhat specified in advance. > > The limitation you advertise is a common problem with data binding > frameworks. They are very rigid and inflexible, and can't handle the > extensibility of XML. Properly written DOM or SAX (or XOM) code does > much better. XSLT does much better still I'd like to second that strongly at least for updatability: changing a Schema (DTD, or whatever structure representation) and associated documents is quite common. We keep doing this in ActiveMath. Changing the POJOs to match is a bit more delicate (and typically has influence much deeper into the code than just the beans). Allow me to add that XPath (which can be used in XOM, DOM, JDOM, XSLT, DOM4j and many others) is the best flexibility and readability you can afford. The performance is smaller, indeed (but not enormous), but the manageability is much greater! paul