diff options
author | Jeremias Maerki <jeremias@apache.org> | 2005-07-25 15:54:20 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2005-07-25 15:54:20 +0000 |
commit | d57530eed04016c68143a1c01ea5320610e4a169 (patch) | |
tree | c878aa89092f5a753fd90db22a87f8810254e302 /src/java/org/apache/fop/render/xml | |
parent | 71e92910e627db28ed5bcff19d4593a7bd284575 (diff) | |
download | xmlgraphics-fop-d57530eed04016c68143a1c01ea5320610e4a169.tar.gz xmlgraphics-fop-d57530eed04016c68143a1c01ea5320610e4a169.zip |
Made Service a stand-alone class so it can be reused.
Made XMLHandler discoverable through the Service class.
Moved XMLHandler collection into new XMLHandlerRegistry class.
Adjusted the Renderers and XMLHandler to the above changes.
This should make it easier to write certain FOP extensions. The changes were triggered by my work on the FOP extension for Barcode4J for the FOP Trunk.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225143 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/xml')
-rw-r--r-- | src/java/org/apache/fop/render/xml/XMLRenderer.java | 8 | ||||
-rw-r--r-- | src/java/org/apache/fop/render/xml/XMLXMLHandler.java | 19 |
2 files changed, 16 insertions, 11 deletions
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index 95ff72564..60b4ee4a8 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -105,7 +105,7 @@ public class XMLRenderer extends AbstractRenderer { * Creates a new XML renderer. */ public XMLRenderer() { - context = new RendererContext(XML_MIME_TYPE); + context = new RendererContext(this, XML_MIME_TYPE); } /** @@ -117,9 +117,7 @@ public class XMLRenderer extends AbstractRenderer { // //userAgent.addExtensionHandler(); XMLHandler handler = new XMLXMLHandler(); - setDefaultXMLHandler(userAgent, XML_MIME_TYPE, handler); - String svg = "http://www.w3.org/2000/svg"; - addXMLHandler(userAgent, XML_MIME_TYPE, svg, handler); + userAgent.getXMLHandlerRegistry().addXMLHandler(handler); } /** @@ -563,7 +561,7 @@ public class XMLRenderer extends AbstractRenderer { Document doc = fo.getDocument(); String ns = fo.getNameSpace(); context.setProperty(XMLXMLHandler.HANDLER, handler); - renderXML(userAgent, context, doc, ns); + renderXML(context, doc, ns); endElement("foreignObject"); } diff --git a/src/java/org/apache/fop/render/xml/XMLXMLHandler.java b/src/java/org/apache/fop/render/xml/XMLXMLHandler.java index 74c54629d..269f1dd45 100644 --- a/src/java/org/apache/fop/render/xml/XMLXMLHandler.java +++ b/src/java/org/apache/fop/render/xml/XMLXMLHandler.java @@ -40,14 +40,11 @@ public class XMLXMLHandler implements XMLHandler { private AttributesImpl atts = new AttributesImpl(); - /** - * @see org.apache.fop.render.XMLHandler#handleXML(RendererContext, Document, String) - */ - public void handleXML(RendererContext context, Document doc, - String ns) throws Exception { + /** @see org.apache.fop.render.XMLHandler */ + public void handleXML(RendererContext context, + org.w3c.dom.Document doc, String ns) throws Exception { TransformerHandler handler = (TransformerHandler) context.getProperty(HANDLER); - //String svg = "http://www.w3.org/2000/svg"; writeDocument(doc, handler); } @@ -166,5 +163,15 @@ public class XMLXMLHandler implements XMLHandler { return result.toString(); } + /** @see org.apache.fop.render.XMLHandler#getMimeType() */ + public String getMimeType() { + return XMLRenderer.XML_MIME_TYPE; + } + + /** @see org.apache.fop.render.XMLHandler#getNamespace() */ + public String getNamespace() { + return null; //Handle all XML content + } + } |