[standards-jig] A Question About Namespaces

Evan Prodromou evan at prodromou.san-francisco.ca.us
Fri Apr 11 11:43:55 UTC 2003


So, in the following four examples, the name and namespace of the
<query> element are equivalent (name = 'query', namespace =
'jabber:iq:browse') according to XML Namespaces:

[0] xmlns attribute in <query>:

   <stream:stream
      to='domain'
      xmlns='jabber:client'
      xmlns:stream='http://etherx.jabber.org/streams'
      version='1.0'>
      
      <!-- ... -->

      <iq to='...' id='...' type='get'>
        <query xmlns='jabber:iq:browse' />
      </iq>

[1] prefix declared and used in <query>:

    <stream:stream
      to='domain'
      xmlns='jabber:client'
      xmlns:stream='http://etherx.jabber.org/streams'
      version='1.0'>
      
      <!-- ... -->

      <iq to='...' id='...' type='get'>
        <br:query xmlns:br='jabber:iq:browse' />
      </iq>

[2] prefix declared in <iq> and used in <query>:

    <stream:stream
      to='domain'
      xmlns='jabber:client'
      xmlns:stream='http://etherx.jabber.org/streams'
      version='1.0'>
      
      <!-- ... -->

      <iq to='...' id='...' type='get' xmlns:br='jabber:iq:browse'>
        <br:query />
      </iq>

[3] prefix declared in <stream> and used in <query>:

   <stream:stream
      to='domain'
      xmlns='jabber:client'
      xmlns:stream='http://etherx.jabber.org/streams'
      xmlns:br='jabber:iq:browse'
      version='1.0'>
      
      <!-- ... -->

      <iq to='...' from='...'  type='get' id='...'>
        <br:query />
      </iq>

I'm unclear as to which of these, if any, is non-standard, according
to XMPP core, section 7.6, first paragraph, i.e.,

   "The child element MUST possess an 'xmlns' namespace declaration
   (other than the stream namespace and the default namespace) that
   defines all data contained within the child element."

Does this require that the child element of a stanza must
_specifically_ have an 'xmlns' attribute, or just that the child must
have a different namespace?

I can see why [3] would be kind of evil -- moving the <iq> stanza
verbatim to another stream would require fixing up the namespace,
although that's far from impossible for a good namespaces-aware
XML writer.

[1] and [2], on the other hand, seem quite fair to me. The namespace
declaration, after all, is completely contained in the stanza. True,
neither has any real advantage over [0]. But are they specifically
excluded?

The only reason I see for excluding them is that so many extant Jabber
processors are namespace-stupid (I know -- I maintain one :-) and
equate "being in namespace X" with "having an 'xmlns' attribute equal
to 'X'". Although, in real terms, that's a very good reason.

This isn't just more namespace bashing -- I'm honestly wondering if
it's ever going to be worth my time and effort to upgrade my Jabber
processor to really grok namespaces.

~ESP

-- 
Evan Prodromou
evan at prodromou.san-francisco.ca.us






More information about the Standards mailing list