Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] reading an xml from a socket

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Wolfgang Hoschek <wolfgang.hoschek AT mac.com>
  • To: "Altman, Alan" <Alan.Altman AT ipc.com>
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] reading an xml from a socket
  • Date: Fri, 20 Oct 2006 12:26:09 -0700

XML does not specify an end-of-document marker. Instead, such framing issues are left to a higher level protocol (e.g. HTTP).

A generic XML parser has no knowledge of the higher level protocol in use, thus will parse until it hits end-of-stream (EOS). For example, HTTP/MIME knows where the end of a response occurs, so an InputStream containing the XML payload derived from a servlet will indicate EOS at the correct spot. If you're not using a protocol that has framing built-in, you'll have to roll your own. Here's a simple example:

msg := length payload
length := 4 byte integer (big endian)
payload := sequence of <length> bytes

For are more thorough discussion of framing issues, see [1] and [2].

[1] RFC 3117: On the Design of Application Protocols, http://www.rfc- editor.org/rfc/rfc3117.txt
[2] Stuart Cheshire and Mary Baker, "Consistent Overhead Byte Stuffing." IEEE/ACM Transactions on Networking, April 1999, http:// www.stuartcheshire.org/papers/COBSforToN.pdf

Wolfgang.

On Oct 20, 2006, at 11:47 AM, Altman, Alan wrote:

I want to read an xml doc from a socket.

I have a socket open and I am waiting to read input that is sent to me.

Forgetting about validating the doc, is there an easy way to know when I
have read a complete doc so that I can start parsing it?



Thanks



DISCLAIMER:
Important Notice *************************************************
This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unintended recipients are prohibited from taking action on the basis of information in this e-mail.E-mail messages may contain computer viruses or other defects, may not be accurately replicated on other systems, or may be intercepted, deleted or interfered with without the knowledge of the sender or the intended recipient. If you are not comfortable with the risks associated with e-mail messages, you may decide not to use e-mail to communicate with IPC. IPC reserves the right, to the extent and under circumstances permitted by applicable law, to retain, monitor and intercept e- mail messages to and from its systems.
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest





Archive powered by MHonArc 2.6.24.

Top of Page