[prev in list] [next in list] [prev in thread] [next in thread] 

List:       batik-users
Subject:    Re: Bogus SVG XML output
From:       Archie Cobbs <archie () dellroad ! org>
Date:       2004-12-09 22:11:14
Message-ID: 41B8CD82.9040300 () dellroad ! org
[Download RAW message or body]

Thomas DeWeese wrote:
> > It seems to me that namespace prefix tags are mere artifacts of the
> > way XML documents are encoded as flat files, and are not actually
> > part of the DOM.
> 
> Well the DOM is perfectly aware of the prefixes.  In fact
> the DOM clearly states that setAttributeNS takes a qname, which
> is the name of the attribute with it's prefix.

Oops, you are exactly right.. I didn't realize setAttributeNS()
required a qualified tag name. That seems weird to me, but whatever.

With that change, it seems to do the right thing, even if you try
to "reuse" a namespace prefix that's already defined in a
containing tag for a different namespace.

However, this won't work:

   setAttributeNS(FOO_NS, "blah:attr1", "hello1");
   setAttributeNS(BAR_NS, "blah:attr2", "hello2");

It exports both attributes under "FOO_NS" (using the "blah" prefix).
It's not clear what the right behavior is in that case.

So this API is badly designed IMHO. E.g., two unrelated pieces of
code might want to both add attributes to the same node, using different
namespaces, yet they would not know how to choose unique prefixes
for those namespaces.

-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com


*
Confidentiality Notice: This e-mail message, including any attachments, is for the \
sole use of the intended recipient(s) and may contain confidential and privileged \
information. Any unauthorized review, use, disclosure or distribution is prohibited. \
If you are not the intended recipient, please contact the sender by reply e-mail and \
                destroy all copies of the original message.
*


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic