I’m looking for a Java library that would allow me to marshal XML to a Java object tree, and vice versa. There are plenty of libraries that would allow me to bind XML to JavaBeans generated by some code generation tool, however, I don’t need those (JAXB, JiBX, Castor and so on).
What I need is a tool which would consume a schema file and an xml file and then return a combination of Maps, Lists and Objects in a manner similar to Jackson’s simple data binding (when it is possible, of course). Jackson is intended for JSON, not for XML; and it lacks the ability to take a schema file in account (because JSON Schema is too immature at the moment).
Can I adapt some existing tools to solve my problem, or should I roll out my own solution with DOM and XSOM?
MOXy’s Dynamic JAXB
MOXy offers a dynamic JAXB implementation. You can bootstrap from an XML schema and instead of static classes you can interact with instances of DynamicEntity with generic get/set methods:
For more information see:
Service Data Objects (SDO)
You could also use Service Data Objects for this (JSR-235).
For more information see: