How to deserialize Java objects from XML?

后端 未结 5 805
暗喜
暗喜 2021-01-16 08:01

I\'m sure this might have been discussed at length or answered before, however I need a bit more information on the best approach for my situation...

Problem

5条回答
  •  孤城傲影
    2021-01-16 08:48

    DOM, SAX and XSLT are different animals.

    DOM parsing loads the entire document into memory, which for 100K to 5MB (very small by today's standards) would work.

    SAX is a stream parser which reads the XML and delivers events to your code for each tag.

    XSLT is a system for transforming one XML tree into another. Even if you wrote a transform that converts the input to a more suitable format, you'd still have to write something using DOM or SAX to convert it into Java objects.

提交回复
热议问题