Batik (and the sample test application in the JSVGCanvas tutorial) fails to opne most of the GNOME SVG files. The entire GNOME iconset can be downloaded from [1]. Attaching a sample file that produces the following stack trace: org.w3c.dom.DOMException: The current document is unable to create an element of the requested type (namespace: http://www.w3.org/2000/svg, name: sfw). at org.apache.batik.dom.AbstractNode.createDOMException(Unknown Source) at org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(Unknown Source) at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source) at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(Unknown Source) at org.apache.batik.bridge.DocumentLoader.loadDocument(Unknown Source) at org.apache.batik.swing.svg.SVGDocumentLoader.run(Unknown Source)
Created attachment 18809 [details] Sample SVG file Forgot to provide a link to the complete GNOME set download: http://ftp.gnome.org/pub/GNOME/sources/gnome-themes-extras/0.9/
Looking at that bundle of SVG files, they seem to have many errors with respect to namespaces (and some other things). From the error you are getting, and not knowing which particular file you tried, it certainly looks like a case of the 'sfw' element being placed in the SVG namespace rather than a different namespace. If you find a particular case you think is valid SVG, and Batik doesn't handle it, please make a not of which particular file it is.
Well, these are GNOME SVG files - aren't those supposed to be valid SVGs, especially the so popular Nuvola set, since these are used under librsvg in GNOME? Almost all Nuvola SVG files in that archive fail to open in Batik.
You'd hope they were valid! But it appears they are not. librsvg is likely very tolerant of non-conforming SVG files (i.e., files that look like SVG files but aren't really). I'll look into filing a bug report with the GNOME people.
If you contact GNOME people, please send me a link to kirillcool@yahoo.com I have some entries on my blog [1] and [2] that i'd like to keep as correct and updated as possible. Nuvola's creator e-mail is david@icon-king.com and his website is http://www.icon-king.com [1] http://weblogs.java.net/blog/kirillcool/archive/2006/09/svg_and_java_ui_1.html [2] http://weblogs.java.net/blog/kirillcool/archive/2006/09/svg_and_java_ui.html