[Expat-discuss] use of expat with socket

Duncan Palmer duncan.palmer@s3group.com
Wed, 25 Jul 2001 13:25:26 +0100


"Allen, Michael B (RSCH)" wrote:
> 
> Just use some special character to signify EOR (end of record) and then
> call XML_ParseBuffer with the isFinal parameter as true when you see it.

This won't actually work (not for me anyway). I had wanted to use the
parser in the following manner:

p = XML_ParserCreate(NULL)

do {
 receive(xml)
 XML_Parse(p, xml, xml length, TRUE)
} while(1)

XML_ParserFree(p)

The document i was feeding to XML_Parse was complete, and i'd set the
isFinal param on XML_Parse. But I had the same problem as Thomas, so
ended up creating a new parser for each XML document. it would be nicer
not to have to do this...
 
Dunk.

> 
> Mike
> 
> > -----Original Message-----
> > From: Thomas J. Clancy [SMTP:tclancy@personity.com]
> > Sent: Tuesday, July 24, 2001 1:23 PM
> > To:   expat-discuss@lists.sourceforge.net
> > Subject:      [Expat-discuss] use of expat with socket
> >
> > Hey There,
> >
> > I'm new to this dicussion group and new to expat, so forgive me if this
> > question has already been asked (I didn't see anything related to this on
> > the web site).
> >
> > I want to use expat to replace our own home brewed XML parser.  The problem
> > is that while I'm getting in data from a socket (the protocol to our product
> > is in XML), I may get more than one XML document at a time.  When I tried to
> > simulate this with the xmlwf app by creating a file that contained two xml
> > documents, expat crapped out with:
> >
> > "junk after document element at line 7."
> >
> > Here is the XML I was messing around with:
> >
> > <?xml version="1.0" ?>
> > <foo>
> >   this is a test
> >   <b>this is</b>
> >   only a test.
> > </foo>
> > <?xml version="1.0" ?>
> > <foo2>
> >   this is a test
> >   <b>this is</b>
> >   only a test.
> > </foo2>
> >
> >
> > I need to detect through some handler that I've reached the end of the
> > document and to not continue processing.  Then I can put away the remainder
> > of the buffer and process it later.  Can this be done?
> >
> >
> > Thomas J. Clancy
> >
> >
> > _______________________________________________
> > Expat-discuss mailing list
> > Expat-discuss@lists.sourceforge.net
> > http://lists.sourceforge.net/lists/listinfo/expat-discuss
> 
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss@lists.sourceforge.net
> http://lists.sourceforge.net/lists/listinfo/expat-discuss

-- 
Duncan Palmer                                    
duncan.palmer@s3group.com
Software Design Engineer                          Phone:    
+353-1-2911561
Silicon and Software Systems                      Fax:      
+353-1-2911001