diff options
-rw-r--r-- | src/java/org/apache/fop/fo/XMLObj.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/fo/XMLObj.java b/src/java/org/apache/fop/fo/XMLObj.java index cf64136fd..c7b3d1b6f 100644 --- a/src/java/org/apache/fop/fo/XMLObj.java +++ b/src/java/org/apache/fop/fo/XMLObj.java @@ -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); } |