Internally in ant the <uri>:<name> form is used (rather
that {uri}name) for a stringized versions of xml namespaced names.

In dom it seems that the prefix is used in the qualified name.
so  e.setAttributeNS(uri, qName, value) should be of
the form:

e.setAttributeNS("http://example.com";, "abc:hello", "hello world")

(see: http://www.oasis-open.org/archives/cgmo-webcgm/200411/msg00004.html)

Unfortunally the ant code does not retain the prefix of the attribute
(encoded
in the qname) see ProjectHelper2:line 1048.

Peter

On 6/13/06, Stephane bailliez <[EMAIL PROTECTED]> wrote:


I would say DOM is a bit 'flexible' about that as this was not very much
specified, so implementation more or less allow it and try to do some
kind of magic later one to try to make sense of it. But my understanding
is that you are correct.

You have some info about it though:

http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/namespaces-algorithms.html



Steve Loughran wrote:
>
> I'm now looking at the namespace aware dynamic attribute stuff
>
> The qname parameter for this is built up as follows:
>                 String qName = ("".equals(uri)
>                                 ? localName : (uri + ":" + localName));
>
>
> this is not how, say, Qname.toString() presents qnames, which is
> {http://example.org}tag
>
> I'd change it, but then I looked at how XmlFragment handled it, which
> it does by handing it off to the Dom element
>
>                 e.setAttributeNS(uri, qName, value);
>
> I dont use classic DOM. but from what the javadocs imply, this appears
> wrong. the qname that Element.setAttributeNS() seems to want is a
> classic prefix:value tuple, like "xmlns:name" or "ant:example".
>
> So really we should pass down the prefix and localname, as the uri
> comes down in the namespace URI param:
>
>                 String qName = ("".equals(uri)
>                                 ? localName : (prefix + ":" +
> localName));
>
> Am I right here? This is not shipping code so we have time to correct
> it, but I'd need input from someone who knows Dom intimately enough to
> get it right. Me, I use Xom :)
>
> -steve
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to