Hi.
We have an XML that needs to be converted to an object and vice versa. Something like Xstream does. Until now we were using Xstream to marshall and unmarshall the object/xml. However the problem is that an object that corresponds to XML in xstream, needs to have all the tags as attributes; else if XML contains any extra tags which are not present in object; it bombs.
Or, we need to have custom convertors written to make sure that the operation goes as desired. I was also suggested that common digester allows Xpath parsing from XML to an object.
I am wondering what is the best approach; as long as:
- I just want to convert XML to Object and vice versa.
- Have the ability to silently ignore any fields in XML that map not be present in mapping object.
What do you suggest?