Java SAX Parsing

前端 未结 5 1182
走了就别回头了
走了就别回头了 2020-12-06 05:25

There\'s an XML stream which I need to parse. Since I only need to do it once and build my java objects, SAX looks like the natural choice. I\'m extending DefaultHandler and

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 05:53

    I do something very similar, but instead of having boolean flags to tell me what state I'm in, I test for player or team being non-null. Makes things a bit neater. This requires you to set them to null when you detect the end of each element, after you've added it to the relevant list.

提交回复
热议问题