]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Non-SVG XML got loaded into a non-namespace-aware node which caused problems later...
authorJeremias Maerki <jeremias@apache.org>
Tue, 7 Feb 2006 14:18:38 +0000 (14:18 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 7 Feb 2006 14:18:38 +0000 (14:18 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@375604 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/XMLObj.java

index cf64136fd6978260c235d4f44147d510c7962378..c7b3d1b6f623b5e0c9963d2d9e92d8f427f6ab33 100644 (file)
@@ -24,6 +24,8 @@ import java.util.HashMap;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 
+import org.apache.batik.dom.svg.SVGDOMImplementation;
+import org.apache.batik.dom.util.XMLSupport;
 import org.apache.fop.apps.FOPException;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -167,11 +169,16 @@ public abstract class XMLObj extends FONode {
             DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance();
             fact.setNamespaceAware(true);
             doc = fact.newDocumentBuilder().newDocument();
-            Element el = doc.createElement(name);
+            Element el = doc.createElementNS(getNamespaceURI(), name);
             doc.appendChild(el);
 
             element = doc.getDocumentElement();
             buildTopLevel(doc, element);
+            if (!element.hasAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns")) {
+                element.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
+                                getNamespaceURI());
+            }
+            
         } catch (Exception e) {
             log.error("Error while trying to instantiate a DOM Document", e);
         }