Hi guys, after upgrading from batik 1.6 to org.apache.xmlgraphics:batik 1.7 I'm facing a problem with importing one SVG document into another. I have the following code snippet:
svgFileLoaderFactory is of type 'SAXSVGDocumentFactory' Document subImageDoc = svgFileLoaderFactory.createDocument(imagePath); subImageDoc.getDocumentElement().setAttribute(X, String.valueOf(x)); subImageDoc.getDocumentElement().setAttribute(Y, String.valueOf(y)); root.getDocumentElement().appendChild(root.importNode(subImageDoc.getDocumentElement(), true)); It seems that either the createDocument or the importNode call creates duplicated ID attributes. I placed a breakpoint into AbstractDocument#importNode(Node, Boolean, Boolean) and saw that in some of the occurring NamedNodeMaps that are storing the attributes, there are two entries with the name 'id', but one has a namespaceURI attached while the other has not. The occurring namespaceURI is 'http://www.w3.org/XML/1998/namespace' which is strange because neither in the imported document nor in my whole application is this namespace used (it's .../XML/2000/...) everywhere. The code of the importNode method mentions something about "bogus id's" in the hash map. I tried to call the method with the trimId attribute set to true but this had no effect. I'm now running out of ideas of how to fix this. Thanks in advance, Simon