aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/apps/FOUserAgent.java39
-rw-r--r--src/java/org/apache/fop/render/AbstractRenderer.java37
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/ps/PSRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/svg/SVGRenderer.java2
-rw-r--r--src/java/org/apache/fop/render/xml/XMLRenderer.java2
6 files changed, 41 insertions, 43 deletions
diff --git a/src/java/org/apache/fop/apps/FOUserAgent.java b/src/java/org/apache/fop/apps/FOUserAgent.java
index 27a3a7532..cbd0ba978 100644
--- a/src/java/org/apache/fop/apps/FOUserAgent.java
+++ b/src/java/org/apache/fop/apps/FOUserAgent.java
@@ -55,17 +55,12 @@ import java.util.Map;
import java.io.IOException;
import java.io.InputStream;
-// XML
-import org.w3c.dom.Document;
-
// Avalon
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
// FOP
import org.apache.fop.pdf.PDFEncryptionParams;
-import org.apache.fop.render.XMLHandler;
-import org.apache.fop.render.RendererContext;
/**
* The User Agent for fo.
@@ -188,39 +183,5 @@ public class FOUserAgent implements LogEnabled {
return true;
}
- /**
- * Render the xml document with the given xml namespace.
- * The Render Context is by the handle to render into the current
- * rendering target.
- * @param ctx rendering context
- * @param doc DOM Document containing the source document
- * @param namespace Namespace URI of the document
- */
- public void renderXML(RendererContext ctx, Document doc,
- String namespace) {
- String mime = ctx.getMimeType();
- Map mh = (Map) handlers.get(mime);
- XMLHandler handler = null;
- if (mh != null) {
- handler = (XMLHandler) mh.get(namespace);
- }
- if (handler == null) {
- handler = (XMLHandler) defaults.get(mime);
- }
- if (handler != null) {
- try {
- handler.handleXML(ctx, doc, namespace);
- } catch (Throwable t) {
- // could not handle document
- getLogger().error("Some XML content will be ignored. "
- + "Could not render XML", t);
- }
- } else {
- // no handler found for document
- getLogger().warn("Some XML content will be ignored. "
- + "No handler defined for XML: " + namespace);
- }
- }
-
}
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java
index a9de32be6..5becb0f6b 100644
--- a/src/java/org/apache/fop/render/AbstractRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractRenderer.java
@@ -58,6 +58,9 @@ import java.util.Map;
import java.util.List;
import java.util.Iterator;
+// XML
+import org.w3c.dom.Document;
+
// FOP
import org.apache.fop.apps.FOPException;
import org.apache.fop.area.Area;
@@ -702,5 +705,39 @@ public abstract class AbstractRenderer extends AbstractLogEnabled
mh.put(ns, handler);
}
+ /**
+ * Render the xml document with the given xml namespace.
+ * The Render Context is by the handle to render into the current
+ * rendering target.
+ * @param ctx rendering context
+ * @param doc DOM Document containing the source document
+ * @param namespace Namespace URI of the document
+ */
+ public void renderXML(FOUserAgent foua, RendererContext ctx, Document doc,
+ String namespace) {
+ String mime = ctx.getMimeType();
+ Map mh = (Map) foua.handlers.get(mime);
+ XMLHandler handler = null;
+ if (mh != null) {
+ handler = (XMLHandler) mh.get(namespace);
+ }
+ if (handler == null) {
+ handler = (XMLHandler) foua.defaults.get(mime);
+ }
+ if (handler != null) {
+ try {
+ handler.handleXML(ctx, doc, namespace);
+ } catch (Throwable t) {
+ // could not handle document
+ getLogger().error("Some XML content will be ignored. "
+ + "Could not render XML", t);
+ }
+ } else {
+ // no handler found for document
+ getLogger().warn("Some XML content will be ignored. "
+ + "No handler defined for XML: " + namespace);
+ }
+ }
+
}
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index 42c917315..2770b9a75 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -1190,7 +1190,7 @@ public class PDFRenderer extends PrintRenderer {
new Integer((int) pos.getWidth()));
context.setProperty(PDFXMLHandler.PDF_HEIGHT,
new Integer((int) pos.getHeight()));
- userAgent.renderXML(context, doc, ns);
+ renderXML(userAgent, context, doc, ns);
}
diff --git a/src/java/org/apache/fop/render/ps/PSRenderer.java b/src/java/org/apache/fop/render/ps/PSRenderer.java
index c71b08373..97551e29b 100644
--- a/src/java/org/apache/fop/render/ps/PSRenderer.java
+++ b/src/java/org/apache/fop/render/ps/PSRenderer.java
@@ -885,7 +885,7 @@ public class PSRenderer extends AbstractRenderer {
context.setProperty(PDFXMLHandler.PDF_HEIGHT,
new Integer((int) pos.getHeight()));
*/
- userAgent.renderXML(context, doc, ns);
+ renderXML(userAgent, context, doc, ns);
}
diff --git a/src/java/org/apache/fop/render/svg/SVGRenderer.java b/src/java/org/apache/fop/render/svg/SVGRenderer.java
index 5bed6232e..97a3ee758 100644
--- a/src/java/org/apache/fop/render/svg/SVGRenderer.java
+++ b/src/java/org/apache/fop/render/svg/SVGRenderer.java
@@ -354,7 +354,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler {
public void renderForeignObject(ForeignObject fo) {
org.w3c.dom.Document doc = fo.getDocument();
String ns = fo.getNameSpace();
- userAgent.renderXML(context, doc, ns);
+ renderXML(userAgent, context, doc, ns);
}
/**
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java
index 6d6af46f3..43f065cf9 100644
--- a/src/java/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java
@@ -429,7 +429,7 @@ public class XMLRenderer extends AbstractRenderer {
org.w3c.dom.Document doc = fo.getDocument();
String ns = fo.getNameSpace();
context.setProperty(XMLXMLHandler.WRITER, writer);
- userAgent.renderXML(context, doc, ns);
+ renderXML(userAgent, context, doc, ns);
writeEndTag("</foreignObject>");
}