ralphm's blog

Wednesday, 6 April 2005

Waving Particles

Reading the discussion by offline offlinestpeter and hildjj, I can't help wondering if we aren't re-inventing XML all over again. So, I wanted to throw the following into the discussion:

<x xmlns="jabber:x:data" xmlns:xdata="jabber:x:data" type="form">
  <s:light xmlns:s="http://jabber.org/protocol/shakespeare"
    <option label="Juliet">Sun</option>
    <option label="Maid">Moon</option>
    <option label="Eyes">Stars</option>
  <author xmlns="http://www.loc.gov" xdata:type="text-single">

As, can be seen, I annotate the child elements in the form with the xdata:type attribute. This is an extension to Data Forms. The following example is equivalent to the previous one, but uses a different annotation with respect to namespaces:

<xdata:x xmlns:xdata="jabber:x:data" type="form">
  <light xmlns="http://jabber.org/protocol/shakespeare"
    <xdata:option label="Juliet">Sun</xdata:option>
    <xdata:option label="Maid">Moon</xdata:option>
    <xdata:option label="Eyes">Stars</xdata:option>
  <author xmlns="http://www.loc.gov" xdata:type="text-single">Shakespeare</author>


XML attributes, without a prefix, don't belong to any namespace, but depend on the containing element for providing their context. So, although the default namespace in the second version is jabber:x:data, this isn't inherited for attributes.