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

Peter Saint-Andre stpeter at jabber.org
Sat Feb 18 05:03:50 UTC 2006

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:


Next we look at "Canonical XML":


Here we find a section on "Order of Namespace Declarations and Attributes":


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:


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

Therefore Tony is right and the xmlns "attribute" (in fact it is a
"reserved attribute", in XPath called a "namespace node") does belong first.

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


- --
Peter Saint-Andre
Jabber Software Foundation

Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3641 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.jabber.org/pipermail/standards/attachments/20060217/ac4cb13d/attachment.bin>

More information about the Standards mailing list