[xml] how do I...



Hi folks, I'm a bit of an XML noob with a how-to question.


I've got a couple of processes that trade XML messages over the network.
The sender writes each XML message on a single newline-terminated line.
The receiver uses select and read, and reads until it gets a '\n',
then passes the line to xmlParseMemory and validates the resulting doc
with xmlValidateDtd.


This works well, but it's a little annoying to have to use '\n' as the
message separator.  What I'd really like is to let the sender spread
its message out over several lines if it wants, and have the receiver
detect the end-of-message without any gross hacks.


I'm imagining a stateful, incremental parser function that I can
repeatedly call with the buffers I read from the network, and it'll
consume up to the end-of-buffer or end-of-message, whichever comes
first, and return me a doc if it finished one, or NULL if it didnt.
If the function didnt consume the whole buffer (because it found an
end-of-message before the end-of-buffer), it'll have to tell me where
it left off so I can call it again with the rest later.


I looked halfheartedly through the docs on the xmlsoft.org website but
was ovewrwhelmed.


Any clues for the clueless?


-- 
Sebastian Kuzminsky
"Marie will know I'm headed south, so's to meet me by and by"
-Townes Van Zandt



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