Thomas DeWeese wrote:
>> I've found a bug in Batik (I think) and would appreciate any comments,
>> confirmation, workarounds, etc.
> 
>    The workaround is simple replace this:
> 
> use.setAttributeNS(XLINK_NS, "href", "#" + BOX_ID);
> 
>    With this:
> 
> use.setAttributeNS(XLINK_NS, "xlink:href", "#" + BOX_ID);
> 
>> The first one is correct but the second one is not, because the
>> "href" attribute is incorrectly put in the null namespace.
> 
>    The question is if it is the XML serializer's responsibility to
> provide 'prefixes' for tags that don't have them.  Remember that
> you could even create an attribute in a namespace that lacks any
> xmlns:<prefix> decl.  Should the serializer then 'create' a
> prefix (and add the xmlns attribute)?

Yes! I've seen it done. Typically these tags will have manufactured
names like "ns0", "ns1", etc.

E.g., when you do XSLT transformations, the output can contain tags
from namespaces defined in any of the input files. These input files
may re-use the same ns prefixes for different namespaces. It is the
XSLT tranformer's responsibility to rename them as appropriate.

>    To be honest I haven't had the time or interest to see what
> DOM 3 Load/Store say on this topic.  But the fix is pretty simple
> and I think that it should work with any implementation.

Thanks, but this workaround is not reliable.

What if that there is no "xlink" namespace tag defined in the
document? Or what if the tag is "xlnk" or "ns7" instead of "xlink"?

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.

So IMHO this is a fairly serious bug that makes it difficult to
reliably export dynamically modified documents.

-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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to