appending SVG string to dom

Posted by Wieringen on Stack Overflow See other posts from Stack Overflow or by Wieringen
Published on 2010-03-20T12:19:23Z Indexed on 2010/03/20 12:21 UTC
Read the original article Hit count: 287

Filed under:
|
|

I'm trying to append a string of svg elements to the dom. This is my setup.

var oFragment = '';
for (var i = 0; i < 10; i++) {
oFragment += '<g><path id="note-1" d="M 6,3 84,6  c 0,0 -6,76 14,91  L 58,97 19,89  c 0,0 -24,-5 -13,-86 z" style="fill:#ffc835;" /></g> ';
}

Here is what i tried. It gives the following error: "parseXML is not defined"

var oSVG = document.getElementById("svg-wall").getSVGDocument();
var oNotes = oSVG.getElementById('notes');
oNotes.appendChild(parseXML(oFragment, document));

So my question is what am i doing wrong and is this even the best way to append a svg string to the dom?

© Stack Overflow or respective owner

Related posts about svg

Related posts about Xml