[jdev] Splitting the stream
Matthias Wimmer
m at tthias.eu
Wed Nov 1 07:38:45 CST 2006
Michal 'vorner' Vaner schrieb:
> And, if I have these split things and insert them between the stream
> header I got in the beginning and an corresponding stream end, can I
> parse it using DOM parser for each separate stanza?
But that is something I would not do. It requires you to parse the
complete data twice. I'd just use a SAX parser for the complete stream.
And with the SAX-events you can generate DOM-Nodes in a DOM-Document.
E.g. you could have one document for the stream, generated inside the
SAX-Events. When you notice, that a stanza has been completed, you can
call the handler for the stanza with the handle/pointer/... to that
element in the document. After the handler returned/the stanza has been
processed, you can just remove that stanza root element from the DOM
document again.
Tot kijk
Matthias
--
Matthias Wimmer Fon +49-700 77 00 77 70
Züricher Str. 243 Fax +49-89 95 89 91 56
81476 München http://ma.tthias.eu/
More information about the JDev
mailing list