[xml] XML streaming with libxml2



Hi,

        Perhaps the answer is obvious, but I could't find it in archive,
        so...
        
        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:

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

        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! :)
        
Regards,
/Al



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