Re: [xml] xml streaming



Martyn,

You should be able to use the Push parser in libxml, see
http://xmlsoft.org/library.html for an overview.
An example of its use is in xmllint.

Essentially, you set up the parser by calling xmlCreatePushParserCtxt(),
then as you get chunks of XML over the stream, feed them in to the parser
with xmlParseChunk().
The links to the API docs for these functions are:
http://xmlsoft.org/html/libxml-parser.html#XMLCREATEPUSHPARSERCTXT
http://xmlsoft.org/html/libxml-parser.html#XMLPARSECHUNK

Using this method, you don't need to receive the fully formed XML document
before parsing as it will parse the XML as it receives it, building up the
DOM tree (or calling the SAX callbacks) on the fly.
When you receive the last bit of XML from the stream, set the terminate flag
in your last call to xmlParseChunk().

Hope this helps,
Richard Jinks


----- Original Message -----
From: "Martyn Russell" <jackrussell subdimension com>
To: <xml gnome org>
Sent: Wednesday, February 27, 2002 9:12 PM
Subject: [xml] xml streaming


I want to have a socket connection to a jabber server and stream xml,
where do I start?

I have looked at some of the headers for functions that might relate to
streaming techniques that would be required and see that I might need to
call functions in parser.h.  If this is the case, can I use the
functions in tree.h in junction with this OR do you have to have a
properly formed XML document before that is the case?

Also, are there any examples that anyone has which could help me get on
my feet?

Thanx,
Regards,

Martyn Russell


_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




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