xml data islands and SVG

admin

Administrator
Staff member
Hi all,

the piece of xml code below was downloaded from the W3C SVG specification.
Any arbitrary piece of SVG xml would have been ok.

If I add it to an XML data island object, the description text (<desc> tag), displays (in anyParentElement) simultaneously with the .innerHTML assignation in Firefox but not in IE7. The image will not render in either platform (though is does in FF when opened as a standalone .xml file).

var xmlSVGtext=(the text shown below);
var xm=document.createElement("xml");
anyParentElement.appendChild(xm);
xm.innerHTML=xmlSVGtext; // xm object innerHTML verified

I am trying to render xml-based SVG images using scripts and objects. Am I going about it wrongly.

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="7cm" height="2cm" viewBox="0 0 700 200"
xmlns="http://www.w3.org/2000/svg" version="1.1">
<desc>Gradients apply to leaf nodes
</desc>
<g>
<defs>
<linearGradient id="MyGradient" gradientUnits="objectBoundingBox">
<stop offset="0%" stop-color="#F60" />
<stop offset="100%" stop-color="#FF6" />
</linearGradient>
</defs>
<rect x="1" y="1" width="698" height="198"
fill="none" stroke="blue" stroke-width="2" />
<g fill="url(#MyGradient)" >
<rect x="100" y="50" width="200" height="100"/>
<rect x="400" y="50" width="200" height="100"/>
</g>
</g>
</svg>
 
Back
Top