Since SVG cannot display line breaks, multiple texts must be created. How to create it? The following is an online example. It is not easy to find and transfer it.
Http://osdir.com/ml/text.xml.svg.devel/2002-08/msg01252.html)
Node = svgdoc. createelement ("text ");
Node. setattribute ("ID", yourid );
Node. setattribute ("X", yourx );
Node. setattribute ("Y", youry );
Node. setattribute ("style", yourstyle );
Textnode = svgdoc. createtextnode ("Hello dynamic text ");
Node. appendchild (textnode );
Yourparent. appendchild (node );
This shoshould do the job...
The only difference is that you have to create a special textnode that will be
Appended to the text-element, which is then appended to it's parent.
Hope this helps,
Andreas
--- In SVG-developers @ XXXX, "dennis_joel_david" <Dennis. myren @ XXXX> wrote:
>Isnt it possible todynamically create a text element and setting its
>Text?
>I am trying to use this function to achieve this.
>This doesnt work, but it seems like when I have already a text
>Element with this ID, and where text is more than empty string
>Already, there is no problem.
>What am I doing wrong?
>Because it has to be possible, because I dont know how plain text
>Elements will be created during the session when my SVG document
>Loads.
>Thank you
>Dennis
>Function createtextelement (text, x, y)
>{
>IND = _ osvgdoc. createelement ('text ');
>Ind. setattribute ('id', '123 ');
>Ind. setattribute ('x', x + (width/2 ));
>Ind. setattribute ('y', Y + (height/2) + 10 );
>Ind. setattribute ('style', 'text-anchor: middle; font-size: 16; font-
>Family: Arial; fill: black ;');
>Ind. setdata ('kalle ');
>// Ind. getfirstchild (). setdata ('kalle ');
>Parent. appendchild (IND );
>}