diff options
author | Jeremias Maerki <jeremias@apache.org> | 2006-02-07 14:18:38 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2006-02-07 14:18:38 +0000 |
commit | fc6a15c27b59633a456dc8d3fcb97dd2c56201f0 (patch) | |
tree | 1e1984372b00dbbc76c7fb82c729d136f64f2abb /src/java/org | |
parent | 5769a0fe9fb13878a9573ea45b5544ca481c1d00 (diff) | |
download | xmlgraphics-fop-fc6a15c27b59633a456dc8d3fcb97dd2c56201f0.tar.gz xmlgraphics-fop-fc6a15c27b59633a456dc8d3fcb97dd2c56201f0.zip |
Non-SVG XML got loaded into a non-namespace-aware node which caused problems later when serializing the foreign XML to the intermediate format. Fixes a problem with serializing barcodes (Barcode4J) to the intermediate format.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@375604 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-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); } |