This is the first instance, which says how to create a new
svg, add elements, save
svgDocument, viewing
svgThe following will be the addition of some common elements: (JS, but basically the same as in Java, the class name is slightly different) Circle
var svgns = "Http://www.w3.org/2000/svg";
Svgdocument = evt.target.ownerDocument;
Shape.setattributens (NULL, "Cy", 25);
Shape.setattributens (NULL, "R", 20);
}
Ellipse
var svgns = "Http://www.w3.org/2000/svg
function Makeshape (EVT)
if (window.svgdocument = = null)
var shape = Svgdocument.createelementns (svgns, "ellipse");
}
Line
var svgns = "Http://www.w3.org/2000/svg
}
Path
var svgns = "Http://www.w3.org/2000/svg
var shape = Svgdocument.createelementns (svgns, "path
}
Polygon
var svgns = "Http://www.w3.org/2000/svg
}
Polyline
var svgns = "Http://www.w3.org/2000/svg
}
Rectangle
var svgns = "Http://www.w3.org/2000/svg
var shape = Svgdocument.createelementns (svgns, "rect "
}
Rounded Rectangle
var svgns = "Http://www.w3.org/2000/svg
var shape = Svgdocument.createelementns (svgns, "rect "
}
Use
var svgns = "Http://www.w3.org/2000/svg";
var xlinkns = "Http://www.w3.org/1999/xlink";
function Makeshape (EVT)
{
if (window.svgdocument = = null)
Svgdocument = evt.target.ownerDocument;
var svgroot = svgdocument.documentelement;
var defs = Svgdocument.createelementns (svgns, "defs");
Varrect= Svgdocument.createelementns (Svgns, "rect");
rect. Setattributens (NULL, "id", "rect");
rect. Setattributens (NULL, "width", 15);
rect. Setattributens (NULL, "height", 15);
rect. Setattributens (null, "style", "Fill:green");
Defs.appendchild (rect);
var use1 = Svgdocument.createelementns (svgns, "use");
Use1.setattributens (NULL, "X", 5);
Use1.setattributens (null, "Y", 5);
Use1.setattributens (Xlinkns, "Xlink:href", "#rect");
Use2 = Svgdocument.createelementns (svgns, "use");
Use2.setattributens (NULL, "X", 30);
Use2.setattributens (null, "Y", 30);
Use2.setattributens (Xlinkns, "Xlink:href", "#rect Svgroot.appendchild (defs);
Svgroot.appendchild (USE1);
Svgroot.appendchild (USE2);
}