[xml] how to validate with DTD when reading chunks



Hello,

I'm new to libxml2 and I can't find a way to validate XML document
when parsing it by chunks. The code below is a part of a client - server
app that I'm writing; the protocol is based on XML.  I'm using code like
this:

xmlSAXHandler sax;
..
.. (initialization of sax struct for my callbacks)
..
ctxt = xmlCreatePushParserCtxt(&sax, imq, buffer, result, NULL);
//
// reading & parsing loop
while (my_read_from_socket_function(..))
{
        if ((r = xmlParseChunk(ctxt, buffer, result, 0)))
        {
                printf("parse error: %d\n", r);
                exit_with_error();
        }
        xmlParseChunk(ctxt, buffer, 0, 1);
}

What I need is a way to validate incoming chunks against externally loaded
DTD without keeping whole xml file in memory. I'd like to load DTD
only once by myself, then use it for every client connection; incoming
client data won't define it's own DTD. Is this possible with libxml2?

Thanks for advance for any help,

Pawel Stolowski

-- 
__________________________________________
[     http://linux.bydg.org/~yogin/      ]
[ VyQChat - free, VypressChat compatible ]
[        chat client for Linux/Qt.       ]



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