Adding a SVG doc from a String to a SVG document using javascript
"deimos1975" <[email protected]>
| Newsgroups | gmane.text.xml.svg.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi! My Javascript function receives a String as a parameter. This String is a svg tag with several nodes as children. I want to parse it into a SVG and add it as a nodechildren to my SVG file is:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-flat-20030114.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" height="100%" width="100%" onload="inicia(evt)" >
<script type="text/ecmascript"><![CDATA[
parent.pinta=pinta
function inicia(event){
SVGDocument = event.target.ownerDocument;
}
function pinta(strSVG){
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.loadXML(strSVG);
var newNode=xmlDoc.documentElement;
SVGDocument.getElementById('grafico1').appendChild(newNode);
}
]]></script>
<svg y="" width="" height="" id="grafico1"/>
<svg y="500" width="" height="" id="grafico2"/>
<g id="tip_Cuadro"/>
<g id="tip_texto"/>
</svg>
Where strSVG="<g id='titulo'><text x='95' y='12'>Title </text></g>"
But this returns a HIERARCHY_REQUEST_ERR (3) On: SVGDocument.getElementById('grafico1').appendChild(newNode);
I think the proble is to parse String to a valid SVG node....
This is on IE9.
Thank you!
------------------------------------
-----
To unsubscribe send a message to: [email protected]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my membership"
----Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/svg-developers/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/svg-developers/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/