As you found, you need to use the InputStreamReader. ----- Original Message ----- From: Dave Cassel <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 13, 1999 1:00 PM Subject: RE: SAX events
> Ted, > > I adopted the stuff you sent me and tried it out. It didn't work at > first, but in the course of comparing files, I noticed I had: > > SAXParser m_parser; > ... > m_parser.parse(new InputSource(m_is)); > > whereas you had: > > SAXParser p; > ... > p.parse(new InputSource(new InputStreamReader(in))); > > -- I hadn't bothered with the Reader. When I put that in, it worked. > Just for kicks, I tried it with the Reader but without your code, and > the original problem was back. It looks like the combination of the > InputStreamReader and your fix did the trick. I wonder if that's an > InputSource bug or just a natural result of not using a Reader. Either > way, it works when the Reader is used. > > Thanks for the help! > > David Cassel > Software Engineer > CyberFone, Inc. > 610-989-9330x33 > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Sent: Friday, December 10, 1999 7:41 PM > > To: [EMAIL PROTECTED] > > Subject: Re: SAX events > > > > > > 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 > > > > > > > > > > > >
