diff options
author | Simon Pepping <spepping@apache.org> | 2006-01-27 20:24:15 +0000 |
---|---|---|
committer | Simon Pepping <spepping@apache.org> | 2006-01-27 20:24:15 +0000 |
commit | 8f160a6bf6550761eaddaca0bccbfe0380ee6876 (patch) | |
tree | 98eeaf3c03488c2c819e3bd20571acfa31bbdebd /src/java/org | |
parent | abebe36d9a0adce5795b86bb359882104757553d (diff) | |
download | xmlgraphics-fop-8f160a6bf6550761eaddaca0bccbfe0380ee6876.tar.gz xmlgraphics-fop-8f160a6bf6550761eaddaca0bccbfe0380ee6876.zip |
Change TransformerHandler to ContentHandler. Use comment method when
available.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@372971 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r-- | src/java/org/apache/fop/render/xml/XMLRenderer.java | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/java/org/apache/fop/render/xml/XMLRenderer.java b/src/java/org/apache/fop/render/xml/XMLRenderer.java index c51c33522..833f3df8a 100644 --- a/src/java/org/apache/fop/render/xml/XMLRenderer.java +++ b/src/java/org/apache/fop/render/xml/XMLRenderer.java @@ -36,6 +36,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.w3c.dom.Document; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.ext.LexicalHandler; import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.ContentHandler; @@ -111,7 +112,7 @@ public class XMLRenderer extends PrintRenderer { /** If not null, the XMLRenderer will mimic another renderer by using its font setup. */ protected Renderer mimic; - /** TransformerHandler that the generated XML is written to */ + /** ContentHandler that the generated XML is written to */ protected ContentHandler handler; /** AttributesImpl instance that can be used during XML generation. */ @@ -197,6 +198,20 @@ public class XMLRenderer extends PrintRenderer { } /** + * Writes a comment to the generated XML. + * @param comment the comment + */ + protected void comment(String comment) { + if (handler instanceof LexicalHandler) { + try { + ((LexicalHandler) handler).comment(comment.toCharArray(), 0, comment.length()); + } catch (SAXException saxe) { + handleSAXException(saxe); + } + } + } + + /** * Starts a new element (without attributes). * @param tagName tag name of the element */ @@ -406,6 +421,9 @@ public class XMLRenderer extends PrintRenderer { } catch (SAXException saxe) { handleSAXException(saxe); } + if (userAgent.getProducer() != null) { + comment("Produced by " + userAgent.getProducer()); + } startElement("areaTree"); } |