top | item 36930196

(no title)

xnyhps | 2 years ago

I don't mind XML personally, but I understand why people dislike it. For XMPP specifically you have to use a streaming XML parser, which is quite a bit more complicated than the more common case of parsing XML into a tree and then traversing that tree. Not all XML libraries even have support for streaming parsers and if you start implementing XMPP with a non-streaming parser you'll end up with something really messy.

Streaming parsers give you a stream of events like "open tag 'message'", "attribute 'from'", "open tag 'body'", "close tag 'body'" and you need to gather those and translate them back into the top-level elements of the stream. This is pretty tedious, and if you do it wrong you may end up leaking memory (if you keep the entire tree around in memory) or even introduce vulnerabilities (similar to https://bugs.chromium.org/p/project-zero/issues/detail?id=22... ).

discuss

order

lostmsu|2 years ago

Sounds like one would just need to build some kind of observables/xpath mishmash for XML streaming, and that would mostly eliminate the problem.

oblio|2 years ago

> one would‡ <<just>>‡ need to build

Let's see what...

> some‡ kind‡ of observables/xpath mishmash‡ for XML streaming

which in the end still leads to:

> would‡ mostly‡ eliminate the problem

Solid programmer-think, right there!

You "just" need to magic up some stuff that in the end <<might>> solve the problem.

E A S Y - PEASY!

‡ LOL at the weasel word count.