xmerl_scan for XMPP -- too much lookahead?
Tony Garnock-Jones
tonyg@REDACTED
Wed Sep 23 15:46:45 CEST 2009
Hi all,
I'm trying to use xmerl_scan to handle XMPP stanzas, and I think I've
found a problem with it. I don't think it's intended for streaming XML
in XMPP-like interleaved-request-and-response-document situations.
The attached program feeds the string "<opentag>" to xmerl_scan. I would
have expected to receive the open-tag event before blocking for more
data, but instead it requires at least one more character of input data
before it will emit the open-tag event! If I instead pass "<opentag> ",
with a space after the close-bracket, it emits the open-tag event as
expected, plus the start of an xmlText, before blocking for more data.
My question, then, is:
Is this a bug? Should xmerl_scan supply the open-tag event before
blocking, when it is fed "<opentag>"?
(The specific context of this problem is dealing with the
<stream:stream> sent by the server at the handshake stage of XEP-114.)
Regards,
Tony
P.S.: to run the attached program,
$ erlc lookaheadbug.erl && erl -run lookaheadbug go
--
[][][] Tony Garnock-Jones | Mob: +44 (0)7905 974 211
[][] LShift Ltd | Tel: +44 (0)20 7729 7060
[] [] http://www.lshift.net/ | Email: tonyg@REDACTED
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lookaheadbug.erl
Type: text/x-erlang
Size: 833 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090923/59708c1e/attachment.bin>
More information about the erlang-questions
mailing list