Java unmarshlling XML to Object which are dynamic

后端 未结 2 1313
死守一世寂寞
死守一世寂寞 2021-01-13 12:55

I\'m looking for best tool/way to create and load JAVA objects from XML definitions. I had checked out JAXB, seems pretty nice, but didn\'t find is there a way to work with

2条回答
  •  深忆病人
    2021-01-13 13:21

    So, you're basically trying to make POJO's (plain old Java objects) using XML files? They are just like data classes, right?

    I'm a big fan of XStream, which is really easy to use and works great if you don't need validation. I've used Castor when validation against a schema was required. I just used XStream to save an object to an xml file and then I can read it back in from anywhere, even if I change the data values associated with the object (which I think is what you mean by "dynamic set of attributes", right?).

提交回复
热议问题