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

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


-----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.

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

Peter

- --
Peter Saint-Andre
Jabber Software Foundation
http://www.jabber.org/people/stpeter.shtml

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

iD8DBQFD9qq1NF1RSzyt3NURAtscAKDjp9kLwiu8gFEQcXPjA2P9gORm4QCg5H0Q
xxxBh2JQFA989/IR+RGyiYs=
=bP9C
-----END PGP SIGNATURE-----
-------------- 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