J
jbi130
Hello,
We're redesigning a custom binary application protocol built on TCP
and I thought we should evaluate some XML options. I have a few
questions on how to best handle a stream of XML data.
The first option I looked at is similar to XMPP. After looking at
XMPP we may be able to use some of it, but since we'd end up writing
our own implementation we are not worried about sticking to a spec.
So, our first option would use a complete document in each direction
as the whole connection.. eg)
<connection>
<message>
...
</message>
...
</connection>
close socket.
What is the best parse model for this? Because the <messages> are
never going to be that big, DOM would be nice b/c it seems simpler to
code. But can DOM be applied to just a section of the whole document?
Is our only (standard) option here to use SAX?
The other option I thought of is to add some framing so each message
is its own document..
NUMBER_OF_BYTES\r\n
<message>
...
</message>
Where NUMBER_OF_BYTES is the length of the following "document" so it
can be read in from the socket then passed to a DOM parser.
So what is the better way? What works better with the available XML
parsers? Our applications are writtin in Python, C and Java.
Sorry if this is all basic, but my XML experience is not about 2 days
old.
Thanks.
We're redesigning a custom binary application protocol built on TCP
and I thought we should evaluate some XML options. I have a few
questions on how to best handle a stream of XML data.
The first option I looked at is similar to XMPP. After looking at
XMPP we may be able to use some of it, but since we'd end up writing
our own implementation we are not worried about sticking to a spec.
So, our first option would use a complete document in each direction
as the whole connection.. eg)
<connection>
<message>
...
</message>
...
</connection>
close socket.
What is the best parse model for this? Because the <messages> are
never going to be that big, DOM would be nice b/c it seems simpler to
code. But can DOM be applied to just a section of the whole document?
Is our only (standard) option here to use SAX?
The other option I thought of is to add some framing so each message
is its own document..
NUMBER_OF_BYTES\r\n
<message>
...
</message>
Where NUMBER_OF_BYTES is the length of the following "document" so it
can be read in from the socket then passed to a DOM parser.
So what is the better way? What works better with the available XML
parsers? Our applications are writtin in Python, C and Java.
Sorry if this is all basic, but my XML experience is not about 2 days
old.
Thanks.