How to properly parse XML with SAX?

后端 未结 6 1116
梦谈多话
梦谈多话 2020-12-30 15:56

I am receiving an XML document from a REST service which shall be parsed using SAX. Please see the following example which was generated out of the XSD.

Setting up th

6条回答
  •  臣服心动
    2020-12-30 16:14

    If it's a reasonably small xml document and the memory/throughput constraints aren't prohibitive to an in memory solution, then you could use JAXB instead. You can generate the required classes from the XSD and simply unmarshall the xml into java objects. If you must use a streaming parser, then consider using StAX instead, I generally find this more intuitive.

提交回复
热议问题