[Standards-JIG] Re: JEP-0091: Delayed Delivery

Ralph Meijer jabber.org at ralphm.ik.nu
Sat Feb 18 15:56:46 UTC 2006


On Fri, Feb 17, 2006 at 10:03:50PM -0700, Peter Saint-Andre wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Off-list, Chatopus developer Tony Yat-Tung Cheung asked me:
> 
> > Hi Peter,
> > 
> > Regarding the JEP-0091, I have a question on the order of the xmlns
> > attribute,
> > 
> > In Example 1,
> > 
> >  <x from='capulet.com'
> >     stamp='20020910T23:08:25'
> >     xmlns='jabber:x:delay'>
> >    Offline Storage
> >  </x>
> > 
> > Shouldn't the xmlns attribute always the first attribute following the
> > <x> element? When an XMPP parser is fully streaming, it will first
> > process the xmlns attribute, before processing the other attributes. In
> > terms of ease of implementation and faster processing, it will be easier
> > to expect first a xmlns attribute before all other attributes.
> > 
> > Is it a requirement that xmlns must be the 1st attribute following the
> > <x> element?
> > 
> > Thanks.
> > 
> > Tony
> 
> Since I think the answer will be more generally useful, I've replied on
> the list...
> 
> You might expect the answer to be in the "Namespaces in XML" spec, but
> that document is very short and does not provide an answer:
> 
> http://www.w3.org/TR/xml-names11/
> 
> Next we look at "Canonical XML":
> 
> http://www.w3.org/TR/xml-c14n
> 
> Here we find a section on "Order of Namespace Declarations and Attributes":
> 
> http://www.w3.org/TR/xml-c14n#NSAttrOrder
> 
> Which states:
> 
> The C14N-20000119 Canonical XML draft alternated between namespace
> declarations and attribute declarations. This is part of the namespace
> prefix rewriting scheme, which this specification eliminates. This
> specification follows the XPath data model of putting all namespace
> nodes before all attribute nodes.
> 
> So we look at the "XML Path Language (XPath)" spec:
> 
> http://www.w3.org/TR/1999/REC-xpath-19991116
> 
> Which states:
> 
> There is an ordering, document order, defined on all the nodes in the
> document corresponding to the order in which the first character of the
> XML representation of each node occurs in the XML representation of the
> document after expansion of general entities. Thus, the root node will
> be the first node. Element nodes occur before their children. Thus,
> document order orders element nodes in order of the occurrence of their
> start-tag in the XML (after expansion of entities). The attribute nodes
> and namespace nodes of an element occur before the children of the
> element. The namespace nodes are defined to occur before the attribute
> nodes.
> 
> Therefore Tony is right and the xmlns "attribute" (in fact it is a
> "reserved attribute", in XPath called a "namespace node") does belong first.

The XPath data model has nothing to do with how XML is serialized. If
you have this start tag:

  <stream:stream xmlns='jabber:client'
                 xmlns:stream='http://etherx.jabber.org/streams'>

The element's full name is only defined after parsing the complete tag.
The same holds for namespaced attributes (note that attributes without a
prefix do NOT belong to the default namespace of the element, but to the
'empty' namespace). The order does not matter.

> I'll have to go through the existing JEPs to clean that up.

Just saved you some work.

-- 
Groetjes,

ralphm



More information about the Standards mailing list