Multiple XML “files” in one stream

前端 未结 2 999
离开以前
离开以前 2020-12-18 13:51

While developing an adapter for a webservice, I\'ve ended up facing a response like this:




        
2条回答
  •  旧巷少年郎
    2020-12-18 14:01

    I don't know of a JAXB tweak; the way I've done this kind of thing is to implement an XmlEventReader (or XmlStreamReader) that simulates end-of-document when needed. Note that Unmarshaller.unmarshal() will take one of these as an argument. To make sure you get the event sequence right, watch a "normal" document's event sequence. You'll do two unmarshal()s.

提交回复
热议问题