Re: [xml] xmlParseChunk...
- From: aliban gmx net
- To: veillard redhat com, xml gnome org
- Subject: Re: [xml] xmlParseChunk...
- Date: Mon, 03 Nov 2003 23:54:02 +0100
On 3 Nov 2003 at 17:28, Daniel Veillard wrote:
yes I know, I did a small Jabber implementation on top of SAX
using libxml2 2 years ago, so it's defintely doable.
Still if the client send <foo>bar</foo> at the TCP/IP
socket interface, you have no garantee to receive the chunk in one block
the only thing saving it is taht usually the XML is "formatted"
and the linefeed will force a flush on the TCP/IP stream.
Worked for me at the time.
if "<stream:stream ....>"
is received i send it to my reader and the reader will
xmlCreatePushParserCtxt() to create the parser buffer. whatever this
does not call any sax handler (at least it should call
documentStart() + elementStart already)
any further socket data is pushed to the reader and the reader does
xmlParseChunk(). whatever this still does not result in callbacks
like elementStart() ... how to do this!? i don't understand...
can you show me sample code?
my code looks like this:
bool StreamReader::StreamBuffer_Add(const char *recvBuff,int iRecv)
{
if(m_ptxmlParserCtx == NULL)
{
m_ptxmlParserCtx = xmlCreatePushParserCtxt(x_SAXHandler,
this,
recvBuff,
iRecv,
"test");
}
if(m_ptxmlParserCtx == NULL)
{
wxLogDebug(wxT("StreamReader::StreamBuffer_Add() - Could not
create PushParserCtxt!"));
return false;
}
}
else
{
if(xmlParseChunk(m_ptxmlParserCtx, recvBuff, iRecv, 0) != 0)
{
wxLogDebug(wxT("StreamReader::StreamBuffer_Add() - ParsingError
1!"));
return false;
}
}
return true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]