[Standards] Re: About stream namespaces

Alexander Gnauck gnauck at ag-software.de
Sun Mar 18 14:37:48 UTC 2007


Korinthenkacker Robin Redeker schrieb:
> The difference, which matters, is that when you read from harddisk you
> are not forced to process the document before you have read the full
> file. You are not _forced_ to parse a partial XML document when you read
> a file.  If you parse it anyway (without special chunked parsing modes
> which some sophisticated parsers have, which are by no means required by
> the XML recommendation), the XML parser is allowed to bail out and call
> it a 'not-well-formed XML document'.

that's wrong. You do exactly the same with big documents when you parse 
them with a Sax or pull parser.
Or do you load a 100MB XML document in a DOM at once?

> XMPP is also without TLS "basically" not well-formed, take a look at this (client
> to server stream example from RFC3920 '6.5. Client-to-Server Example'):
> 
>    *** tcp connection established ***
>    <?xml version='1.0'?>
>    <stream:stream
>        xmlns='jabber:client'
>        xmlns:stream='http://etherx.jabber.org/streams'
>        to='example.com'
>        version='1.0'>
> 
>    <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl'
>          mechanism='DIGEST-MD5'/>
> 
>    <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
>    dXNlcm5hbWU9InNvbWVub2RlIixyZWFsbT0ic29tZXJlYWxtIixub25jZT0i
>    T0E2TUc5dEVRR20yaGgiLGNub25jZT0iT0E2TUhYaDZWcVRyUmsiLG5jPTAw
>    MDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZXhhbXBsZS5jb20i
>    LHJlc3BvbnNlPWQzODhkYWQ5MGQ0YmJkNzYwYTE1MjMyMWYyMTQzYWY3LGNo
>    YXJzZXQ9dXRmLTgK
>    </response>
> 
>    <response xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
> 
>    <stream:stream
>        xmlns='jabber:client'
>        xmlns:stream='http://etherx.jabber.org/streams'
>        to='example.com'
>        version='1.0'>
> 
>    <stanzas-here xmlns='this:is-a-placeholder-for-xml-stanzas'/>
> 
>    </stream:stream>
>    *** tcp connection lost ***
> 
> Whoooops, where is the missing closing </stream:stream> tag?
> 
> I know that after sasl authentication the client is supposed to 'flush'
> everything. But what travels the wire is still not a well-formed XML document.

Thats not a protocol problem but a implementation problem. If your 
parser has a problem with that then push the </stream:stream> yourself 
to the parser if you get a socket exception and you are fine.

Alex




More information about the Standards mailing list