wanghua96_1 wrote: > I want to use batik to generate svg and display it, and I have a xml > configuration file(meta.xml). I read configuration from the meta.xml > and use batik to generate the corresponding svg,but it can't display > in JSVGCanvas. But if I use SVGGraphics2D,it works fine,see comment > code.I don't where the problem is,and I hope some help,thanks.
You have two basic problems (both namespace related). First you are using createElement instead of createElementNS with the SVG namespace: > Element g = svg.createElement("g"); Second the SVG elements in your view document are not in the SVG namespace they are in the no-name namespace, so although the tag name is the same they are not SVG element's and hence aren't rendered. > <?xml version="1.0" encoding="UTF-8"?> > <MetaList> [....] > <line Type="Line" > style="fill:rgb(255,255,255);fill-opacity:1;stroke:rgb(0,0,0);stroke-opacity:1;" > > x1="0" y1="0" x2="24" y2="24" /> Probably the easiest thing to do would be to add an xmlns:svg decl to your root element and then prefix the SVG elements with 'svg:': <svg:line ..../> ----- 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/ <*> 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/