[Standards] XEP 297 xmlns and lang preservation in forwarding
kurt.zeilenga at isode.com
Thu Aug 14 21:19:24 UTC 2014
On Aug 14, 2014, at 1:45 PM, Dave Cridland <dave at cridland.net> wrote:
> On 14 August 2014 21:34, Kurt Zeilenga <kurt.zeilenga at isode.com> wrote:
> Maybe a reworded implementation approach...
> Copy stanza verbatim from the stream it was received on into <forwarded/>, replicate any applicable item from that stream which is, per normal XML processing, inherited by the stanza, by augmentation of the <forwarded/> element, such as by copying all namespace declarations and any xml:;lang attribute, to the <forwarded/> element and, if necessary, changing the prefix for the forwarded namespace so that it's distinct from those copied from that stream.
> The primary rationale for this approach is that allows verbatim copying of the stanza from the stream it was received on (or created in respect to) into a <forwarded/> element and avoids the need for deep inspection of the stanza to be forwarded.
> With the exception of a theoretical case where the stream namespace has been somehow used within a stanza, I think all you need to do is declare the content namespace as the default namespace in the forwarded element, and copy the xml:lang from the stream to the forwarded element.
> If you're worried about the theoretical stream case, copy that one too. I suspect that in most cases, you can rewrite the stanza tag itself without concern, thus eliding any tautological declaration of the content namespace.
I rather program defensively so I don't have to worry if practice catches up to theory.
> No other namespaces need to be copied; the only other one on the stream header would be dialback; all others are illegal.
In 6120, dialback is mentioned in the namespace in a "for instance" comment, implying it's not the only possible such namespace declaration that could be present in the stream element. For instance, wouldn't it also be legal to declare the session management namespace (XEP 198) in the stream element. And the more such for instances there are, the more likely practice will catch up to theory here.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Standards