[jdev] Help parsing incremental XML

Craig Hollabaugh craig at hollabaugh.com
Sat Mar 27 11:07:04 CST 2004


JD,

Having intermediate callbacks is the main reason why people
use a SAX parser. So that is an implementation issue with
.NET's SAX parser.

Craig



On Fri, Mar 26, 2004 at 11:16:16PM -0800, JD Conley wrote:
> Unfortunately the parser masquerading as SAX in the .NET Framework
> doesn't work like that.  It will only raise the callbacks once it finds
> the end of the document.  For example, if you attach the parser to a
> Jabber stream from a socket you will only get a callback for the
> <stream:stream> opening element, then the parser will simply hang until
> it receives the </stream:stream> closing element, at which point the
> callbacks for anything in between will be raised.  
> 
> Obviously this is a limitation in the .NET parser, but I figured it was
> most likely present in other parsers.
> 
> JD
> 
> > -----Original Message-----
> > From: Dr. Craig Hollabaugh [mailto:craig at hollabaugh.com] 
> > Sent: Friday, March 26, 2004 10:14 PM
> > To: Jabber software development list
> > Subject: RE: [jdev] Help parsing incremental XML
> > 
> > JD and Kevin,
> > 
> > SAX parsers parse as the stream comes in. Your code gets 
> > callbacks on a
> > tag by tag basis. A DOM parser creates a complete document to
> > manipulate. If you're parsing is really simple, you can use a regular
> > expression to find what you're looking for.
> > 
> > Craig
> > 
> > 
> > 
> > On Fri, 2004-03-26 at 23:08, JD Conley wrote:
> > > That sort of parsing is the basis of XMPP/Jabber.  In many 
> > cases SAX and
> > > DOM parsers do require the whole document.  But there are 
> > parsers that
> > > will parse a stream as it comes in.  I'm not sure how it's 
> > usually done
> > > in Java -- I'm a .NET guy myself -- but there are a few 
> > open source Java
> > > Jabber libraries available that you can look at.  The list 
> > of the most
> > > complete/popular libraries is here:
> > > http://www.jabber.org/software/libraries.php
> > > 
> > > Are you using Jabber for your project?  If not, you should 
> > check into
> > > it.  It will allow you to send your application's XML as payload in
> > > Jabber stanzas and will handle the routing, authentication, 
> > and all the
> > > particulars you probably don't want to worry about.
> > > 
> > > JD 
> > > 
> > > > -----Original Message-----
> > > > From: Kevin Zablonski [mailto:kzablonski at riches85.com] 
> > > > Sent: Friday, March 26, 2004 7:40 PM
> > > > To: jdev at jabber.org
> > > > Subject: [jdev] Help parsing incremental XML
> > > > 
> > > > I am developing an IM client/server application for the 
> > > > visually impaired
> > > > that will make use of the Java Speach API.  I am developing 
> > > > it as a senior
> > > > project and I am stuck on the XML parsing.  I am having 
> > > > trouble finding a
> > > > technology that will allow me to parse XML incrementally.  
> > > > The client will
> > > > connect to the server over a socket connection.  From there, 
> > > > the client
> > > > and the server will continually pass small XML streams back 
> > > > and forth.  I
> > > > have done some research into SAX and DOM, but it looks as if 
> > > > they expect
> > > > the whole document at once.  I was just wondering if it was 
> > > > possible and
> > > > if so, what technologies are being used.  I could just use 
> > > > some direction
> > > > direction right now.  I would appreciate any suggestions 
> > > > and/or comments
> > > > that could stear me in the right direction.  Thanks in Advance.
> > > > _______________________________________________
> > > > jdev mailing list
> > > > jdev at jabber.org
> > > > https://jabberstudio.org/mailman/listinfo/jdev
> > > > 
> > > _______________________________________________
> > > jdev mailing list
> > > jdev at jabber.org
> > > https://jabberstudio.org/mailman/listinfo/jdev
> > -- 
> > ------------------------------------------------------------
> > Dr. Craig Hollabaugh, craig at hollabaugh.com
> > Author of Embedded Linux: Hardware, Software and Interfacing
> > www.embeddedlinuxinterfacing.com
> > 
> > 
> > _______________________________________________
> > jdev mailing list
> > jdev at jabber.org
> > https://jabberstudio.org/mailman/listinfo/jdev
> > 
> _______________________________________________
> jdev mailing list
> jdev at jabber.org
> https://jabberstudio.org/mailman/listinfo/jdev
> 

-- 
------------------------------------------------------------
Dr. Craig Hollabaugh, craig at hollabaugh.com
Author of Embedded Linux: Hardware, Software and Interfacing
www.embeddedlinuxinterfacing.com



More information about the JDev mailing list