Re: [xml] xmlTextReaderExpand expanding until the end of a tree ?



Hi,

I'm resuming this thread to ensure that things really go the right way here.

If I get it right, xmlTextReaderExpand reads beyond current node to
get some information for it. But imagine a situation: 2 sides are
using streamed XML negotiation and the first side opens a stream,
sending some metadata (say, some id) for the second side to continue.
The second side cannot proceed w/o this metadata; the first side does
not want to expose any data before receiving initial answer from S2.
So S2 tries to read a node received, but gets stuck because there is
no next node yet. Hence it cannot even start negotiation.

This is quite abstract, but there's a real example for it. That's an
XMPP protocol, while S1 is an XMPP server providing
"<stream:features>" and S2 is a client waiting for those features to
arrive.

S1 to S2:
<?xml version='1.0'?>
<stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' id='3753721882'
from='d522e0' version='1.0' xml:lang='en'>
        <stream:features>
                <mechanisms 
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism></mechanisms>
                <c xmlns='http://jabber.org/protocol/caps' hash='sha-1'
node='http://www.process-one.net/en/ejabberd/'
ver='yy7di5kE0syuCXOQTXNBTclpNTo='/>
                <register xmlns='http://jabber.org/features/iq-register'/>
        </stream:features>

S2 reads <stream:stream> opening tag and skips to <stream:features>.
While applying xmlTextReaderExpand to it, one stops badly waiting for
TCP connection to retrieve more data, while nobody is going to provide
any.

So I'm interested what's that important information
xmlTextReaderExpand waits for and is it really THIS important? Can we
have an option to stop it from reading beyond the current node closing
tag or is there any other known workaround for this?

Or maybe I'm missing something here?

Thanks

Artem

---- original message ----
    From: Daniel Veillard <veillard redhat com>
    To: =?utf-8?b?5buW5ouv?= <c_liao openfind com tw>
    Cc: xml gnome org
    Subject: Re: [xml] xmlTextReaderExpand expanding until the end of a tree ?
    Date: Thu, 29 Apr 2004 10:20:23 -0400

On Thu, Apr 29, 2004 at 06:33:22PM +0800, ÃÂâÃâ wrote:
if I use function xmlTextReaderExpand, shouldn't I get a xmlNode whose next node is NULL ? or at least the 
expanded tree can't extend further into group (name="aa").

  The only garantee you have is that xmlTextReaderExpand will expand
all the subtree, it may actually grow more of the tree than just the
subtree since the chunk parsed will in general not end up exactly
on the boundary of the subtree and more data might be processed.
  So getting a next node is likely, it's actually one of the ways
to be sure the subtree is actually complete.
  So assuming I understood your question correctly, then the answer is
that it's normal and even expected most of the time.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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