xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Lindsey" <kevlin...@kevlindev.com>
Subject CreateElement in 1.5b-1
Date Mon, 06 May 2002 14:36:51 GMT
Hello,

I'm in the process of trying to update examples on my site so they will work with both Batik
and ASV.  I've started with a simple example; however, I'm must be missing something obvious.
 The SVG+ECMAScript code below works in ASV, but not in the Batik-1.5b1 SVG Browser (Win2K,
JRE1.3.1).  Interestingly, the DOM viewer shows the new circle, but it is not displayed. 
I've looked over the 3D.svg example file, so I know this is possible, but still no success.
 I apologize for the long post.  I decided to include the full file in case I'm doing something
silly that I'm just not seeing:

<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
    "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" [
    <!ATTLIST svg
              xmlns:a3 CDATA #IMPLIED
              a3:scriptImplementation CDATA #IMPLIED>
    <!ATTLIST script
              a3:scriptImplementation CDATA #IMPLIED>
]>
<svg onload="init(evt)"
     xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     xmlns:a3="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
     a3:scriptImplementation="Adobe">
    <script type="text/ecmascript" a3:scriptImplementation="Adobe"><![CDATA[
        var svgns = "http://www.w3.org/2000/svg";

        function init(e) {
            if ( window.svgDocument == null )
                svgDocument = e.target.ownerDocument;
            
            createCircle(100,100);
        }

        function createCircle(x, y) {
            var circle = svgDocument.createElementNS(svgns, "circle");

            circle.setAttribute("cx", x);
            circle.setAttribute("cy", y);
            circle.setAttribute("r", 5);
            circle.setAttribute("fill", "red");
            
            svgDocument.documentElement.appendChild(circle);
        }
    ]]></script>
</svg>

Thanks for any help on this,
Kevin
KevLinDev - http://www.kevlindev.com

Mime
View raw message