xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spepp...@apache.org
Subject svn commit: r372971 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/render/xml/XMLRenderer.java test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
Date Fri, 27 Jan 2006 20:24:28 GMT
Author: spepping
Date: Fri Jan 27 12:24:15 2006
New Revision: 372971

URL: http://svn.apache.org/viewcvs?rev=372971&view=rev
Log:
Change TransformerHandler to ContentHandler. Use comment method when
available.

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java?rev=372971&r1=372970&r2=372971&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/xml/XMLRenderer.java Fri Jan 27 12:24:15
2006
@@ -36,6 +36,7 @@
 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 @@
     /** 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 @@
     }
 
     /**
+     * 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
      */
@@ -405,6 +420,9 @@
             handler.startDocument();
         } catch (SAXException saxe) {
             handleSAXException(saxe);
+        }
+        if (userAgent.getProducer() != null) {
+            comment("Produced by " + userAgent.getProducer());
         }
         startElement("areaTree");
     }

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java?rev=372971&r1=372970&r2=372971&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
(original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/intermediate/AreaTreeParserTestCase.java
Fri Jan 27 12:24:15 2006
@@ -192,7 +192,7 @@
         
         XMLRenderer renderer = new XMLRenderer();
         renderer.mimicRenderer(targetRenderer);
-        renderer.setTransformerHandler(handler);
+        renderer.setContentHandler(handler);
         renderer.setUserAgent(userAgent);
 
         userAgent.setRendererOverride(renderer);
@@ -223,7 +223,7 @@
         DOMResult domResult = new DOMResult();
         handler.setResult(domResult);
         XMLRenderer renderer = new XMLRenderer();
-        renderer.setTransformerHandler(handler);
+        renderer.setContentHandler(handler);
 
         FOUserAgent userAgent = createUserAgent();
         userAgent.setRendererOverride(renderer);



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org


Mime
View raw message