[jdev] Re: Parsing XMPP/Jabber protocol
Trejkaz Xaoza
trejkaz at trypticon.org
Wed Dec 29 08:06:38 CST 2004
On Thu, 30 Dec 2004 00:45, Mickael Remond wrote:
> Maxym Gorodetskyy wrote:
> > Well, if I am using java?
>
> To parse stream you need an event-based parser (SAX support) and not a
> tree based parser (like DOM), because a tree-based parser need to have
> the complete document to build the tree in memory.
> Sax based parsing send events during parsing regarding opening/closing
> tags, contents, etc and can thus parse a stream (potentially infinite).
>
> In Java, Xerces support both mode for example.
There is a place in-between. Parsers like XPP2 have the ability to build
fragments of the tree as they do incremental parsing. Plus, the added
advantage of using pull parsing is that you have (almost) full control over
the parser loop.
(I say "almost" because if your stream has something like "<stream:str" in it,
the parser will usually halt waiting for the "eam>" unless you're really
tricky. :-))
TX
--
Email: Trejkaz Xaoza <trejkaz at trypticon.org>
Web site: http://xaoza.net/
Jabber ID: trejkaz at jabber.zim.net.au
GPG Fingerprint: 9EEB 97D7 8F7B 7977 F39F A62C B8C7 BC8B 037E EA73
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20041230/827438ab/attachment-0002.pgp>
More information about the JDev
mailing list