jeudi 21 janvier 2016

Design practices for sax parsing

While most posts recommend a streaming parser versus an in-memory parser (DOM) for performance, all the code snippets that show example code usually show a long and "tedius" approach of looping over tokens/tags, checking the token name and instantiating a specific class, then going over the inner tokens/tags and extracting and populating the class's member fields etc in a long if/else functional logic.
My question is, if one decides to use a streaming parser what is the most appropriate design pattern to use to structure the code?

Aucun commentaire:

Enregistrer un commentaire