Hello,
I'm having a bit of a problem with adding text to the desc
element. When I
add text to the desc element, it adds the text to the next
line and not
after the <desc>. For example in the svg it'll look
like this:
<rect>
<desc>
hello</desc>
</rect>
This cause the tool tip to show up as 2 lines, the first one
being empty and
the second line showing hello. In java I've coded it as
follows:
Element nextPatElement = patternDoc.createElementNS(null,
"rect");
nextPatElement.setAttributeNS(null, "x",
Integer.toString(x));
nextPatElement.setAttributeNS(null, "y",
Integer.toString(y));
nextPatElement.setAttributeNS(null, "width",
Integer.toString(PATTERN_DIM));
nextPatElement.setAttributeNS(null, "height",
Integer.toString(PATTERN_DIM));
nextPatElement.setAttributeNS(null, "stroke",
"black");
nextPatElement.setAttributeNS(null, "class",
pattern.getPatternName());
nextPatElement.setAttributeNS(null, "id",
pattern.getPatternName());
Element desc = patternDoc.createElementNS(null,
"desc");
desc.setTextContent(pattern.getPatternName());
nextPatElement.appendChild(desc);
root.appendChild(nextPatElement);
I've also tried:
Element nextPatElement = patternDoc.createElementNS(null,
"rect");
nextPatElement.setAttributeNS(null, "x",
Integer.toString(x));
nextPatElement.setAttributeNS(null, "y",
Integer.toString(y));
nextPatElement.setAttributeNS(null, "width",
Integer.toString(PATTERN_DIM));
nextPatElement.setAttributeNS(null, "height",
Integer.toString(PATTERN_DIM));
nextPatElement.setAttributeNS(null, "stroke",
"black");
nextPatElement.setAttributeNS(null, "class",
pattern.getPatternName());
nextPatElement.setAttributeNS(null, "id",
pattern.getPatternName());
Element desc = patternDoc.createElementNS(null,
"desc");
Text text =
patternDoc.createTextNode(pattern.getPatternName());
desc.appendChild(text);
nextPatElement.appendChild(desc);
root.appendChild(nextPatElement);
But neither seems to work. Any hints on how I would fix
this problem.
vyang
--
View this message in context: http://www.nabble.com/desc-text-add-problem-
tf4752451.html#a13589459
Sent from the Batik - Users mailing list archive at
Nabble.com.
------------------------------------------------------------
---------
To unsubscribe, e-mail: batik-users-unsubscribe xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help xmlgraphics.apache.org
|