re: Stopping XML parsing in mid-stream?

Michael Chang <[email protected]>
Newsgroups gmane.text.xml.sax.general
Message-ID <[email protected]>
>  > Except that, when reading from my InputStream, no exceptions are
>  > ever thrown; parse() just keeps on reading and reading and reading.
>  > An exception *is* thrown once I forcefully close the connection on
>  > the server end, but that's obviously not a workable solution :)
> 
> I'm not sure I understand -- you're the one who will have to throw the
> exception, in your ContentHandler.endElement() method.
Which is exactly what I'm doing.  But neither endElement() nor any of the
other methods implemented by DefaultHandler get called.

> If that never
> gets called, then your SAX parser might be doing a lot of
> forward-buffering -- that's a separate, implementation-specific
> problem,
This is what I had suspected -- namely, that SAXParser maintains an
internal buffer and does not begin the actual parsing until it reaches
the end of the stream.

> and might be solvable by switching to a different SAX parser.
Possibly.  Do the other SAX parsers have the same method names?
Can I seamlessly change my system properties to use a new parser
without having to change any code?



Michael



-- 
/* BEGIN SIG 
*
* "Afraid of change, afraid of staying the same,
*  when temptation calls, we just look away."
*  - Barenaked Ladies
*
* "He started writing in mirror writing, 'Help! I'm
*  trapped behind the world.'"
*  - New York State Journal of Medicine
*
*-----------------------------
* Michael Chang
* [email protected]
* http://www.syndetic.org/
*/



-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com
_______________________________________________
List: [email protected]
See:  http://www.saxproject.org
https://lists.sourceforge.net/lists/listinfo/sax-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.