[xml] XML streaming with libxml2


        Perhaps the answer is obvious, but I could't find it in archive,
        Lets say that I've stream (TCP or whatever) which I want to use to
        exchange XML messages. Basically, what I want is to determinine that
        XML message is sent completely, and only then pass it on to parser.
        Normally, this should not be difficult, but... Valid XML may contain
        only one root node, so I just can't pass on input to the parse - it
        won't be accepted (I can't compute packet length in advance so I
        can't read specific number of bytes).
        So the question - is there any _reliable_ and _clean_ way (in
        libxml2 or any third-party library) to determine that complete XML
        document (with known start tag) is received?
        Say, I've the following input:

        <?xml version="1.0" encoding="ISO-8859-1" ?>    
        <packet seq=1>
        <?xml version="1.0" encoding="ISO-8859-1" ?>  
        <packet seq=2>

        How to force the parser to accept only first portion (<packet
        seq=1>), indicate that first document (packet) was accepted, then
        advance on the second and so on?

        Any clues? Tips? Suggestions? :)

        Thanks! :)

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