As you say the AbstractNode.importNode method initially creates an Attr
without a value but then, I think, because the deep flag is true it performs
getFirstChild() on the Attr node ( and gets an AbstractParentNode ) it then
recurses with this node, this node is handled as a TEXT_NODE and the result
(ie. the attribute value) is added to the Attr node.
I never knew that attributes in the DOM were represented this way! The
DOM 2 Core spec bears out your explanation.
thanks Cameron and Patrick for your help. I see that the Document I am passing
to the deepCloneDocument() method has attribute nodes with values but the
values are not as a child Text Node. This document is a result of the XSL
transformation using javax.xml.transform.Transformer::transform(). I am not
sure why the attribute node values doesn't have child text node.
As a workaround, I have implemented my own version of copy routine which
copies from the original DOM to the SVG DOM implementation ( will all attribute
values, ofcourse ). I could render most of the SVGs I have with this implementation.
I still have one further problem. This probably has nothing to do with the
problem we have been discussing so far. I have some SVG content with embedded
gif images. These embedded images are lost during jpeg conversion. My jpeg
conversion is running within Servlet and I have tried the following values
for xlink:href with no success
1. <image x="60" y="65" width="32" height="25" xlink:href="cloud.gif"
2. <image x="60" y="65" width="32" height="25" xlink:href="file:///
directory path>/cloud.gif" />
3. <image x="60" y="65" width="32" height="25" xlink:href="<relative
path to the web application>/cloud.gif" />