OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xml-dev] Parsing Streaming XML Incrementally



OK, I'll try again :-)

So, you've confirmed that the XML sent to the server and the XML returned
each are well formed.

You've re-iterated that the two XML streams are emitted interleaved.

You have confirmed that you open and do not close the connections until the
whole exchange is complete.

It seems to me that you cannot use a DOM interface here because the DOM
parsers expect to see a complete document because they are expected to
return a complete representation of that document to the application. So you
must use an event parser, say SAX. It seems to me that this should work
because the SAX parser doesn't (shouldn't) expect the document to be
complete before the first callback is made. Are you saying that you are
using event callbacks already?

Have you tried using the console (i.e. Stdin/stdout) as the server so you
can simulate things?

Cheers,
Bob

On 01/11/15 11:17 AM, "Development Role Account" <dev@neurosphere.com>
wrote:

> On Thu, 15 Nov 2001, Bob Hutchison wrote:
> 
>> Don't close the stream from the server (actually either stream). If you do
>> this then an event based parser like SAX will call a handler/call-back for
>> each event it receives. If you write your request pieces from the handler
>> methods, then you should get an interleaved protocol going.
> 
> The client code is already structured in that manner. There is a
> state machine, and whenever data is received from the server it is parsed,
> and client emits an appropriate response according to what it has received
> and what state it is in.
> 
>> If you close the connections, or try to use a parser that has to read ahead
>> you will have a problem. (So don't generate a DOM).
> 
> It is not a SAX/DOM issue either - at least for all of the perl parsers
> I've been using, both SAX and DOM models expect a well-formed document ...
> SAX parsers will respond to XML tags as they are encountered, but if
> closing tags are not seen after the complete document has been scanned,
> the parser croaks. The problem being that none of the "documents" emitted
> by the server are complete ... but the client still needs to react to
> the XML fragments.
> 
>> Just a guess. I hope I said it clearly enough to be understood.
> 
> Thanks - try again :)
> 
> -sjs
> 
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org <http://www.xml.org>, an
> initiative of OASIS <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
>