When should I choose SAX over StAX?

前端 未结 6 785
青春惊慌失措
青春惊慌失措 2020-12-07 08:25

Streaming xml-parsers like SAX and StAX are faster and more memory efficient than parsers building a tree-structure like DOM-parsers. SAX is a push parser, meaning that it\'

6条回答
  •  醉酒成梦
    2020-12-07 09:08

    To generalize a bit, I think StAX can be as efficient as SAX. With the improved design of StAX I can't really find any situation where SAX parsing would be preferred, unless working with legacy code.

    EDIT: According to this blog Java SAX vs. StAX StAXoffer no schema validation.

提交回复
热议问题