What is best practice in converting XML to Java object?

后端 未结 10 887
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 16:02

I need to convert XML data to Java objects. What would be best practice to convert this XML data to object?

Idea is to fetch data via a web service (it doesn\'t use WSDL

相关标签:
10条回答
  • 2021-02-13 16:25

    JAXB is a standard API for doing this: http://java.sun.com/developer/technicalArticles/WebServices/jaxb/

    0 讨论(0)
  • 2021-02-13 16:25

    For this you can also consider apache's bitwixt and simple framework for xml

    0 讨论(0)
  • 2021-02-13 16:26

    I've used XStream as well, it is easy to use and customizable. You can add your own custom converters and that was very handy for me...

    0 讨论(0)
  • 2021-02-13 16:28

    JAXB API which comes in Java(In built).

    0 讨论(0)
  • 2021-02-13 16:31

    So surprised more people have not mentioned Jibx. Amazing lib and i think a lot simpler to use than Jaxb. Performance is also fab!

    0 讨论(0)
  • 2021-02-13 16:35

    Another option is a Sax Parser. It is procedural - i.e. a visitor pattern - but if the xml is fairly lightweight, (and even medium weight) I have found it to be very useful for this.

    0 讨论(0)
提交回复
热议问题