Hi David,

I recently checked in some fixes that provide a solution to this problem.
The fixes allow the parser to react to data as it comes in, instead of in
buffer sized (16K) blocks. 

I've attached a source file that shows how to make use of the new
functionality.  I'll try to write this up and add it to the docs soon.

Ted
----- Original Message ----- 
From: "Dave Cassel" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, December 10, 1999 11:39 AM
Subject: SAX events


> Forgive me if this has been brought up before, but I can't find anything
> about it.  
> 
> First off:  Win NT 4.0, Sun JDK 1.1.8, Xerces-J 1.0.  
> 
> I'm writing something where a client sends XML messages to a server and
> the server responds to the messages individually.  I've tried a couple
> different ways and can't get it to work.  The server is using SAX to
> parse the input.  
> 
> My first try was to have the client send a couple of full documents.
> However, the server griped about this:  
> "[Fatal Error] :1 :37: The markup in the document following the root
> element must be well-formed."   Okay, it figures the top-level element
> is the root and doesn't want to see other elements after that.  I guess
> it doesn't see anything it can interpret as an end-of-document.  Fair
> enough.  
> 
> For testing, I then tried just manually writing some strings to the
> stream.  I gave it a <ROOT> element, inside of which I gave it a <MSG>
> element.  I had the client pause a few seconds and then write a second
> <MSG> element, and then closed the <ROOT>.  All the elements were
> correctly received -- but not until everything had been written.  (I
> flushed the stream after writing the first <MSG>.)  
> 
> Shouldn't the server get & interpret elements as soon as they are
> available from the stream?  Does SAX wait to have an entire element
> before it calls events?  I can't close the stream between messages; it
> seems I can't have them in seperate documents; so how do I get the
> server to react to the incoming data?  Is this a problem with Xerces or
> with what I'm trying to do with it?  
> 
> Thanks!
> 
> David Cassel
> Software Engineer
> CyberFone, Inc.
> 610-989-9330x33
> 
> 
> 

Attachment: StreamingSAXClient.java
Description: Binary data

Reply via email to