Hi Gerrit,
Response inline...
> Running the above code with Batik 1.6 or 1.7 produces the following
> output:
[output]
>
>
> Not only is the xlink namespace added a second time (it was already
> present in the root element), but the namespace prefix is missing in the
> href attribute. Since attributes, unlike elements, have no default
> namespace, the attribute is not a valid xlink:href attribute any more.
True, the output does seem broken.
[...]
> I therefore suspect that some error occurs during serialization.
>
> Am I maybe missing something? What would be the correct way to add an
> xlink:href reference, or a use element with default attributes? What
> method is used to create the other xlink attributes that are lined up so
> nicely?
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. ;-)
> Thanks for any insights.
>
> Regards,
> Gerrit
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
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]