Hi Helder, thanks a lot for your tips.
I used your line taken from [1], and it worked. Apparently, you have to
pass a qualified attribute name which includes the prefix. This is even
specified in the org.w3c.dom.Element interface.
I also browsed the SVN repository, and it seems that XLinkSupport is
still omitting the prefix. The current code (revision 475477) is
public static void setXLinkHref(Element elt, String str) {
elt.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_ATTRIBUTE, str);
}
where XLINK_HREF_ATTRIBUTE = "href".
It probably should be
elt.setAttributeNS(XLINK_NAMESPACE_URI, XLINK_HREF_QNAME, str);
with XLINK_HREF_QNAME = XLINK_PREFIX + ':' + XLINK_HREF_ATTRIBUTE.
Same goes for all other attribute getters and setters in XLinkSupport.
Should I maybe file a bug somewhere or are these functions intended to
work in another way?
Regards,
Gerrit
> I have a couple of suggestions:
>
> // XLinkSupport.setXLinkHref( useElement, "somefile.svg#someid" );
> // use DOM2 instead. a tightly related sample is in the FAQ [1]
> // (more related information is available in the website [2] and in
> the mailing list archives [3])
> useElement.setAttributeNS("http://www.w3.org/1999/xlink",
> "xlink:href", "somefile.svg#someid");
>
> // I'd suggest appending to the document only after completely setting it up
> // (this may hold performance benefits in some situations)
> doc.getDocumentElement().appendChild(useElement);
>
> If the above doesn't help, I'd also suggest attempting with the
> current trunk version [4]: I recall a couple of namespace-related
> fixes post the 1.7 release. ;-)
>
> Hope this helps,
> Helder
>
>
> [1] http://xmlgraphics.apache.org/batik/faq.html#changes-are-not-rendered
> [2] http://xmlgraphics.apache.org/batik/using/dom-api.html#buildsvgdoc
> [3] http://www.nabble.com/Batik-f308.html
> [4] http://xmlgraphics.apache.org/batik/download.cgi#Subversion+repository
--
http://www.fastmail.fm - Choose from over 50 domains or use your own
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]