[xml] parsing network buffer chunks



Hello all,

I'm a beginner when it comes to libxml2, so here is my question:
I'm working at a small XMPP client. I have a stream that I receive from the network, the received buffer is fed into my Parser class, chunk by chunk, as the data is received. I may receive incomplete fragments of XML data:
"<stream><presence from='user1 dom" and at the next read from socket I should get the rest:
"ain.com to='hatter wonderland lit/'/>".
The parser should report an error in this case.

I'm only interested in elements having depth 0 and depth 1, like stream and presence in my example above. I need to parse this kind of stream and for each of this elements, depth 0 or 1, create a  xmlNodePtr (I have classes representing stream, presence elements that take as input a xmlNodePtr). So this means I must be able to create an xmlNodePtr from only an start element like <stream>, because the associated end element(</stream> in this case) is received only when the communication is finished.
I would like to use a pull parser.

What are the best functions to use in this case ? xmlReaderForIO, XmlReaderForMemory etc ?

Thank you !

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]