Dear Thomas, Thank you for the swift reply. I modified the code to make my factory namespace aware as follows: DocumentBuilderFactory newInstance = DocumentBuilderFactory.newInstance(); newInstance.setNamespaceAware(true); Document d = newInstance.newDocumentBuilder().parse(FILENAME); JSVGCanvas canvas = new JSVGCanvas(); canvas.setDocument(d); and that worked. I did see those comments about namespaces in the FAQ but I didn't think they applied in this case, so apologies for that.
Peter On Wed, Apr 7, 2010 at 1:36 PM, <thomas.dewe...@kodak.com> wrote: > Hi Peter, > > Peter Hull <peterhul...@gmail.com> wrote on 04/07/2010 07:16:55 AM: > >> I am trying to display a document which was created with a different >> DOM implementation. The documentation seems to suggest this is >> possible but I get an exception. Please could someone explain what's >> happening? > >> Example code fragment: >> Document d = >> DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(FILENAME); > > The main issue is, I think, that your XML parser is not configured > to be namespace aware. Without namespaces you end up with an > 'svg' element that is not in the SVG namespace and consequently > when we import your DOM for the canvas it ends up not being an > SVGSVGElement - which means that it can't be displayed in the canvas. > > --------------------------------------------------------------------- To unsubscribe, e-mail: batik-users-unsubscr...@xmlgraphics.apache.org For additional commands, e-mail: batik-users-h...@xmlgraphics.apache.org