Créer un élément du DOM de SVG à partir d'une Chaîne

Comment pourrais-je aller sur la création d'un élément du DOM de SVG à partir d'un String?

Exemple:

var svgStr = '<svg width="500" height="400" xmlns="http://www.w3.org/2000/svg"><!-- Created with Method Draw - http://github.com/duopixel/Method-Draw/--><g><title>background</title><rect fill="#fff" id="canvas_background" height="402" width="502" y="-1" x="-1"/><g display="none" overflow="visible" y="0" x="0" height="100%" width="100%" id="canvasGrid"><rect fill="url(#gridpattern)" stroke-width="0" y="0" x="0" height="100%" width="100%"/></g></g><g><title>Layer 1</title><path id="svg_1" d="m118,242l64,-153l63,157c0,0 45,-71 49,-68c4,3 11,146 12,146c1,0 -173,-7 -173,-7c0,0 -61,-72 -61,-72c0,0 110,-156 46,-3z" fill-opacity="0.7" stroke-width="2" stroke="#995757" fill="#995757"/></g></svg>';
Quelle langue est-ce? (var ne fait pas partie de SVG ou XML; c'est du JavaScript? Une autre langue?)Merci d'éditer votre question et ajouter les informations nécessaires.
fait juste, désolé. C'est en JavaScript
J'ai posté une réponse possible. Vous pouvez l'essayer dans le JSFiddle.

OriginalL'auteur Nik Kyriakides | 2014-06-08