cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r743301 - in /cocoon/cocoon3/trunk: cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/ cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/ cocoon-sample/src/main/java...
Date Wed, 11 Feb 2009 11:02:55 GMT
Author: reinhard
Date: Wed Feb 11 11:02:54 2009
New Revision: 743301

URL: http://svn.apache.org/viewvc?rev=743301&view=rev
Log:
. use cocoon-xml
. rename AbstractSAXProduce#getXMLConsumer() to AbstractSAXProducer#getSAXConsumer()

Removed:
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/AttributeTypes.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/AttributesImpl.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/EmbeddedSAXPipe.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/ImmutableAttributesImpl.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/IncludeSAXConsumer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SaxBuffer.java
Modified:
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/BetwixtBeanGenerator.java
    cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/NekoGenerator.java
    cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java
    cocoon/cocoon3/trunk/cocoon-sax/pom.xml
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXPipelineComponent.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/SAXConsumer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/FileGenerator.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/IncludeTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/StringGenerator.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLSerializer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SAXConsumerAdapter.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java
    cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/component/RequestParametersGenerator.java
    cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServiceConsumerGenerator.java
    cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceGenerator.java
    cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java
    cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceTransformer.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ExceptionGenerator.java
    cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
    cocoon/cocoon3/trunk/parent/pom.xml

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/BetwixtBeanGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/BetwixtBeanGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/BetwixtBeanGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/betwixt/BetwixtBeanGenerator.java Wed Feb 11 11:02:54 2009
@@ -54,7 +54,7 @@
     }
 
     @Override
-    protected void setXMLConsumer(SAXConsumer xmlConsumer) {
+    protected void setSAXConsumer(SAXConsumer xmlConsumer) {
         this.saxBeanWriter = new SAXBeanWriter(xmlConsumer);
 
         if (this.bindingConfiguration != null) {

Modified: cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/NekoGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/NekoGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/NekoGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-optional/src/main/java/org/apache/cocoon/optional/pipeline/components/sax/neko/NekoGenerator.java Wed Feb 11 11:02:54 2009
@@ -46,7 +46,7 @@
     }
 
     public void execute() {
-        this.saxParser.setContentHandler(this.getXMLConsumer());
+        this.saxParser.setContentHandler(this.getSAXConsumer());
 
         try {
             this.saxParser.parse(this.htmlSource.toExternalForm());

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/main/java/org/apache/cocoon/sample/generation/TimestampGenerator.java Wed Feb 11 11:02:54 2009
@@ -22,13 +22,13 @@
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.sax.AbstractSAXGenerator;
 import org.apache.cocoon.sax.SAXConsumer;
-import org.apache.cocoon.sax.util.ImmutableAttributesImpl;
+import org.apache.cocoon.xml.sax.ImmutableAttributesImpl;
 import org.xml.sax.SAXException;
 
 public class TimestampGenerator extends AbstractSAXGenerator {
 
     public void execute() {
-        SAXConsumer consumer = this.getXMLConsumer();
+        SAXConsumer consumer = this.getSAXConsumer();
         try {
             try {
                 Thread.sleep(500);

Modified: cocoon/cocoon3/trunk/cocoon-sax/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/pom.xml?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/pom.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/pom.xml Wed Feb 11 11:02:54 2009
@@ -41,6 +41,10 @@
       <artifactId>cocoon-pipeline</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.cocoon</groupId>
+      <artifactId>cocoon-xml</artifactId>
+    </dependency>
+    <dependency>
       <groupId>commons-logging</groupId>
       <artifactId>commons-logging</artifactId>
       <exclusions>

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXPipelineComponent.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXPipelineComponent.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXPipelineComponent.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXPipelineComponent.java Wed Feb 11 11:02:54 2009
@@ -18,8 +18,6 @@
 
 import org.apache.cocoon.pipeline.component.AbstractPipelineComponent;
 
-public abstract class AbstractSAXPipelineComponent
-    extends AbstractPipelineComponent
-    implements SAXPipelineComponent {
+public abstract class AbstractSAXPipelineComponent extends AbstractPipelineComponent implements SAXPipelineComponent {
 
 }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXProducer.java Wed Feb 11 11:02:54 2009
@@ -24,11 +24,11 @@
 
 public abstract class AbstractSAXProducer extends AbstractSAXPipelineComponent implements SAXProducer {
 
-    private SAXConsumer xmlConsumer;
+    private SAXConsumer saxConsumer;
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.pipeline.component.Producer#setConsumer(org.apache.cocoon.pipeline.component.Consumer)
      */
     public final void setConsumer(Consumer consumer) {
@@ -36,15 +36,15 @@
             throw new SetupException("XMLProducer requires an XMLConsumer.");
         }
 
-        this.setXMLConsumer((SAXConsumer) consumer);
+        this.setSAXConsumer((SAXConsumer) consumer);
     }
 
-    protected SAXConsumer getXMLConsumer() {
-        return this.xmlConsumer;
+    protected SAXConsumer getSAXConsumer() {
+        return this.saxConsumer;
     }
 
-    protected void setXMLConsumer(SAXConsumer xmlConsumer) {
-        this.xmlConsumer = xmlConsumer;
+    protected void setSAXConsumer(SAXConsumer xmlConsumer) {
+        this.saxConsumer = xmlConsumer;
     }
 
     @Override

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXSerializer.java Wed Feb 11 11:02:54 2009
@@ -70,6 +70,7 @@
      * 
      * @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
      */
+    @Override
     public void setConfiguration(Map<String, ? extends Object> configuration) {
         if (configuration.containsKey("mime-type")) {
             this.contentType = (String) configuration.get("mime-type");
@@ -88,20 +89,12 @@
      * 
      * @see org.apache.cocoon.pipeline.component.PipelineComponent#setup(java.util.Map)
      */
+    @Override
     public void setup(Map<String, Object> inputParameters) {
         this.inputParameters = inputParameters;
     }
 
     /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.pipeline.component.PipelineComponent#finish()
-     */
-    public void finish() {
-        // do nothing
-    }
-
-    /**
      * 
      * {@inheritDoc}
      * 

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXTransformer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/AbstractSAXTransformer.java Wed Feb 11 11:02:54 2009
@@ -20,8 +20,10 @@
 import java.util.List;
 
 import org.apache.cocoon.pipeline.ProcessingException;
-import org.apache.cocoon.sax.util.SaxBuffer;
+import org.apache.cocoon.sax.util.SAXConsumerAdapter;
+import org.apache.cocoon.xml.sax.SAXBuffer;
 import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 
@@ -30,31 +32,31 @@
     private List<String[]> namespaces = new ArrayList<String[]>();
 
     public void characters(char[] ch, int start, int length) throws SAXException {
-        this.getXMLConsumer().characters(ch, start, length);
+        this.getSAXConsumer().characters(ch, start, length);
     }
 
     public void comment(char[] ch, int start, int length) throws SAXException {
-        this.getXMLConsumer().comment(ch, start, length);
+        this.getSAXConsumer().comment(ch, start, length);
     }
 
     public void endCDATA() throws SAXException {
-        this.getXMLConsumer().endCDATA();
+        this.getSAXConsumer().endCDATA();
     }
 
     public void endDocument() throws SAXException {
-        this.getXMLConsumer().endDocument();
+        this.getSAXConsumer().endDocument();
     }
 
     public void endDTD() throws SAXException {
-        this.getXMLConsumer().endDTD();
+        this.getSAXConsumer().endDTD();
     }
 
     public void endElement(String uri, String localName, String name) throws SAXException {
-        this.getXMLConsumer().endElement(uri, localName, name);
+        this.getSAXConsumer().endElement(uri, localName, name);
     }
 
     public void endEntity(String name) throws SAXException {
-        this.getXMLConsumer().endEntity(name);
+        this.getSAXConsumer().endEntity(name);
     }
 
     public void endPrefixMapping(String prefix) throws SAXException {
@@ -74,43 +76,43 @@
             }
         }
 
-        this.getXMLConsumer().endPrefixMapping(prefix);
+        this.getSAXConsumer().endPrefixMapping(prefix);
     }
 
     public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
-        this.getXMLConsumer().ignorableWhitespace(ch, start, length);
+        this.getSAXConsumer().ignorableWhitespace(ch, start, length);
     }
 
     public void processingInstruction(String target, String data) throws SAXException {
-        this.getXMLConsumer().processingInstruction(target, data);
+        this.getSAXConsumer().processingInstruction(target, data);
     }
 
     public void setDocumentLocator(Locator locator) {
-        this.getXMLConsumer().setDocumentLocator(locator);
+        this.getSAXConsumer().setDocumentLocator(locator);
     }
 
     public void skippedEntity(String name) throws SAXException {
-        this.getXMLConsumer().skippedEntity(name);
+        this.getSAXConsumer().skippedEntity(name);
     }
 
     public void startCDATA() throws SAXException {
-        this.getXMLConsumer().startCDATA();
+        this.getSAXConsumer().startCDATA();
     }
 
     public void startDocument() throws SAXException {
-        this.getXMLConsumer().startDocument();
+        this.getSAXConsumer().startDocument();
     }
 
     public void startDTD(String name, String publicId, String systemId) throws SAXException {
-        this.getXMLConsumer().startDTD(name, publicId, systemId);
+        this.getSAXConsumer().startDTD(name, publicId, systemId);
     }
 
     public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
-        this.getXMLConsumer().startElement(uri, localName, name, atts);
+        this.getSAXConsumer().startElement(uri, localName, name, atts);
     }
 
     public void startEntity(String name) throws SAXException {
-        this.getXMLConsumer().startEntity(name);
+        this.getSAXConsumer().startEntity(name);
     }
 
     public void startPrefixMapping(String prefix, String uri) throws SAXException {
@@ -118,10 +120,10 @@
             this.namespaces.add(new String[] { prefix, uri });
         }
 
-        this.getXMLConsumer().startPrefixMapping(prefix, uri);
+        this.getSAXConsumer().startPrefixMapping(prefix, uri);
     }
 
-    private SAXConsumer originalXMLConsumer;
+    private SAXConsumer originalSAXConsumer;
 
     private boolean isRecording;
 
@@ -130,24 +132,26 @@
      * 
      * @param recorder
      */
-    protected void setRecorder(SAXConsumer recorder) {
+    protected void setRecorder(ContentHandler recorder) {
         if (this.isRecording) {
             throw new ProcessingException("Only one recorder can be set.");
         }
 
         this.isRecording = true;
-        this.originalXMLConsumer = this.getXMLConsumer();
-        this.setXMLConsumer(recorder);
+        this.originalSAXConsumer = this.getSAXConsumer();
+        SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
+        saxConsumerAdapter.setContentHandler(recorder);
+        this.setSAXConsumer(saxConsumerAdapter);
     }
 
     /**
      * Remove a recorder. Do not invoke this method directly.
      */
-    protected SAXConsumer removeRecorder() {
-        SAXConsumer saxBuffer = this.getXMLConsumer();
-        this.setXMLConsumer(this.originalXMLConsumer);
+    protected ContentHandler removeRecorder() {
+        SAXConsumerAdapter saxBufferAdapter = (SAXConsumerAdapter) this.getSAXConsumer();
+        this.setSAXConsumer(this.originalSAXConsumer);
         this.isRecording = false;
-        return saxBuffer;
+        return saxBufferAdapter.getContentHandler();
     }
 
     /**
@@ -155,16 +159,16 @@
      * resulting SAXBuffer can be obtained by the matching {@link #endSAXRecording} call.
      */
     public void startSAXRecording() throws SAXException {
-        this.setRecorder(new SaxBuffer());
+        this.setRecorder(new SAXBuffer());
         this.sendStartPrefixMapping();
     }
 
     /**
      * Stop recording of SAX events. This method returns the resulting XMLizable.
      */
-    public SaxBuffer endSAXRecording() throws SAXException {
+    public SAXBuffer endSAXRecording() throws SAXException {
         this.sendEndPrefixMapping();
-        return (SaxBuffer) this.removeRecorder();
+        return (SAXBuffer) this.removeRecorder();
     }
 
     /**
@@ -174,7 +178,7 @@
         final int l = this.namespaces.size();
         for (int i = 0; i < l; i++) {
             String[] prefixAndUri = this.namespaces.get(i);
-            super.getXMLConsumer().startPrefixMapping(prefixAndUri[0], prefixAndUri[1]);
+            super.getSAXConsumer().startPrefixMapping(prefixAndUri[0], prefixAndUri[1]);
         }
     }
 
@@ -185,7 +189,7 @@
         final int l = this.namespaces.size();
         for (int i = 0; i < l; i++) {
             String[] prefixAndUri = this.namespaces.get(i);
-            this.getXMLConsumer().endPrefixMapping(prefixAndUri[0]);
+            this.getSAXConsumer().endPrefixMapping(prefixAndUri[0]);
         }
     }
 }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/SAXConsumer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/SAXConsumer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/SAXConsumer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/SAXConsumer.java Wed Feb 11 11:02:54 2009
@@ -23,5 +23,4 @@
 import org.xml.sax.ext.LexicalHandler;
 
 public interface SAXConsumer extends ContentHandler, LexicalHandler, Consumer {
-
 }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/FileGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/FileGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/FileGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/FileGenerator.java Wed Feb 11 11:02:54 2009
@@ -78,7 +78,7 @@
         }
 
         try {
-            XMLUtils.toSax(this.source.openConnection(), this.getXMLConsumer());
+            XMLUtils.toSax(this.source.openConnection(), this.getSAXConsumer());
         } catch (IOException e) {
             throw new ProcessingException("Can't open connection to " + this.source, e);
         }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/IncludeTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/IncludeTransformer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/IncludeTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/IncludeTransformer.java Wed Feb 11 11:02:54 2009
@@ -25,7 +25,7 @@
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.pipeline.util.StringRepresentation;
 import org.apache.cocoon.sax.AbstractSAXTransformer;
-import org.apache.cocoon.sax.util.IncludeSAXConsumer;
+import org.apache.cocoon.xml.sax.EmbeddedSAXPipe;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.xml.sax.Attributes;
@@ -64,9 +64,9 @@
             URL source = this.createSource(sourceAtt);
 
             XMLReader xmlReader = XMLReaderFactory.createXMLReader();
-            xmlReader.setContentHandler(this.getXMLConsumer());
-            IncludeSAXConsumer includeXMLConsumer = new IncludeSAXConsumer(this.getXMLConsumer());
-            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", includeXMLConsumer);
+            xmlReader.setContentHandler(this.getSAXConsumer());
+            EmbeddedSAXPipe embeddedSAXPipe = new EmbeddedSAXPipe(this.getSAXConsumer());
+            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", embeddedSAXPipe);
 
             BufferedInputStream inputStream = new BufferedInputStream(source.openStream());
             xmlReader.parse(new InputSource(inputStream));

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java Wed Feb 11 11:02:54 2009
@@ -67,12 +67,14 @@
     }
 
     @Override
-    protected void setXMLConsumer(SAXConsumer xmlConsumer) {
+    protected void setSAXConsumer(SAXConsumer xmlConsumer) {
         ValidatorHandler validatorHandler = this.schema.newValidatorHandler();
         validatorHandler.setErrorHandler(new SchemaErrorHandler(this.logger, this.source.toExternalForm()));
         validatorHandler.setContentHandler(xmlConsumer);
 
-        super.setXMLConsumer(new SAXConsumerAdapter(validatorHandler, xmlConsumer));
+        SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
+        saxConsumerAdapter.setContentHandler(validatorHandler);
+        super.setSAXConsumer(saxConsumerAdapter);
     }
 
     private void init(URL source) {

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/StringGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/StringGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/StringGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/StringGenerator.java Wed Feb 11 11:02:54 2009
@@ -47,7 +47,7 @@
      */
     public void execute() {
         try {
-            XMLUtils.toSax(new ByteArrayInputStream(this.xmlString.getBytes()), this.getXMLConsumer());
+            XMLUtils.toSax(new ByteArrayInputStream(this.xmlString.getBytes()), this.getSAXConsumer());
         } catch (PipelineException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLSerializer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLSerializer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLSerializer.java Wed Feb 11 11:02:54 2009
@@ -68,7 +68,6 @@
         this.transformerHandler.getTransformer().setOutputProperties(this.format);
 
         this.setContentHandler(this.transformerHandler);
-        this.setLexicalHandler(this.transformerHandler);
     }
 
     public CacheKey constructCacheKey() {

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java Wed Feb 11 11:02:54 2009
@@ -78,7 +78,7 @@
     }
 
     @Override
-    protected void setXMLConsumer(SAXConsumer consumer) {
+    protected void setSAXConsumer(SAXConsumer consumer) {
         TransformerHandler transformerHandler;
         try {
             transformerHandler = this.createTransformerHandler();
@@ -104,7 +104,9 @@
         TraxErrorListener traxErrorListener = new TraxErrorListener(this.log, this.source.toExternalForm());
         transformerHandler.getTransformer().setErrorListener(traxErrorListener);
 
-        super.setXMLConsumer(new SAXConsumerAdapter(transformerHandler, transformerHandler));
+        SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
+        saxConsumerAdapter.setContentHandler(transformerHandler);
+        super.setSAXConsumer(saxConsumerAdapter);
     }
 
     private TransformerHandler createTransformerHandler() throws Exception {
@@ -119,7 +121,8 @@
 
         // Create transformer handler
         final TransformerHandler handler = transformerFactory.newTransformerHandler(templatesHandler.getTemplates());
-        handler.getTransformer().setErrorListener(new XSLTProcessorErrorListener(this.log, this.source.toExternalForm()));
+        handler.getTransformer().setErrorListener(
+                new XSLTProcessorErrorListener(this.log, this.source.toExternalForm()));
 
         return handler;
     }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SAXConsumerAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SAXConsumerAdapter.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SAXConsumerAdapter.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/SAXConsumerAdapter.java Wed Feb 11 11:02:54 2009
@@ -19,128 +19,41 @@
 import java.util.Map;
 
 import org.apache.cocoon.sax.SAXConsumer;
-import org.xml.sax.Attributes;
+import org.apache.cocoon.xml.sax.AbstractSAXPipe;
 import org.xml.sax.ContentHandler;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
 
-public class SAXConsumerAdapter implements SAXConsumer {
+public class SAXConsumerAdapter extends AbstractSAXPipe implements SAXConsumer {
 
-    protected ContentHandler contentHandler;
-    protected LexicalHandler lexicalHandler;
-    protected SAXConsumer consumer;
-
-    public SAXConsumerAdapter() {
-    }
-
-    public SAXConsumerAdapter(ContentHandler contentHandler, LexicalHandler lexicalHandler) {
-        super();
-        this.contentHandler = contentHandler;
-        this.lexicalHandler = lexicalHandler;
-    }
-
-    public void setConsumer(SAXConsumer consumer) {
-        this.consumer = consumer;
-        this.setContentHandler(consumer);
-        this.setLexicalHandler(consumer);
-    }
-
-    public void setContentHandler(ContentHandler contentHandler) {
-        this.contentHandler = contentHandler;
-    }
-
-    public void setLexicalHandler(LexicalHandler lexicalHandler) {
-        this.lexicalHandler = lexicalHandler;
-    }
-
-    public void characters(char[] ch, int start, int length) throws SAXException {
-        this.contentHandler.characters(ch, start, length);
-    }
-
-    public void comment(char[] ch, int start, int length) throws SAXException {
-        this.lexicalHandler.comment(ch, start, length);
-    }
-
-    public void endCDATA() throws SAXException {
-        this.lexicalHandler.endCDATA();
-    }
-
-    public void endDocument() throws SAXException {
-        this.contentHandler.endDocument();
-    }
-
-    public void endDTD() throws SAXException {
-        this.lexicalHandler.endDTD();
-    }
-
-    public void endElement(String uri, String localName, String name) throws SAXException {
-        this.contentHandler.endElement(uri, localName, name);
-    }
-
-    public void endEntity(String name) throws SAXException {
-        this.lexicalHandler.endEntity(name);
-    }
-
-    public void endPrefixMapping(String prefix) throws SAXException {
-        this.contentHandler.endPrefixMapping(prefix);
-    }
-
-    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
-        this.contentHandler.ignorableWhitespace(ch, start, length);
-    }
-
-    public void processingInstruction(String target, String data) throws SAXException {
-        this.contentHandler.processingInstruction(target, data);
-    }
-
-    public void setDocumentLocator(Locator locator) {
-        this.contentHandler.setDocumentLocator(locator);
-    }
-
-    public void skippedEntity(String name) throws SAXException {
-        this.contentHandler.skippedEntity(name);
-    }
-
-    public void startCDATA() throws SAXException {
-        this.lexicalHandler.startCDATA();
-    }
-
-    public void startDocument() throws SAXException {
-        this.contentHandler.startDocument();
-    }
-
-    public void startDTD(String name, String publicId, String systemId) throws SAXException {
-        this.lexicalHandler.startDTD(name, publicId, systemId);
-    }
-
-    public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
-        this.contentHandler.startElement(uri, localName, name, atts);
-    }
-
-    public void startEntity(String name) throws SAXException {
-        this.lexicalHandler.startEntity(name);
-    }
-
-    public void startPrefixMapping(String prefix, String uri) throws SAXException {
-        this.contentHandler.startPrefixMapping(prefix, uri);
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.pipeline.component.PipelineComponent#finish()
+     */
+    public void finish() {
     }
 
-    public void finish() {
-        if (this.consumer != null) {
-            this.consumer.finish();
-        }
+    /**
+     * Provide access to the {@link ContentHandler} used by the adapter.
+     * 
+     * @return {@link ContentHandler}
+     */
+    public ContentHandler getContentHandler() {
+        return this.contentHandler;
     }
 
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
+     */
     public void setConfiguration(Map<String, ? extends Object> configuration) {
-        if (this.consumer != null) {
-            this.consumer.setConfiguration(configuration);
-        }
     }
 
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.pipeline.component.PipelineComponent#setup(java.util.Map)
+     */
     public void setup(Map<String, Object> parameters) {
-        if (this.consumer != null) {
-            this.consumer.setup(parameters);
-        }
     }
 }

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/XMLUtils.java Wed Feb 11 11:02:54 2009
@@ -34,6 +34,9 @@
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.pipeline.util.URLConnectionUtils;
 import org.apache.cocoon.sax.SAXConsumer;
+import org.apache.cocoon.xml.sax.EmbeddedSAXPipe;
+import org.apache.cocoon.xml.sax.SAXBuffer;
+import org.xml.sax.ContentHandler;
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -54,7 +57,7 @@
      * @param outputStream OutputStream to use.
      * @param saxBuffer A SaxBuffer containing the SAX events.
      */
-    public static void toOutputStream(final OutputStream outputStream, final SaxBuffer saxBuffer) {
+    public static void toOutputStream(final OutputStream outputStream, final SAXBuffer saxBuffer) {
         try {
             TransformerHandler transformerHandler = SAX_TRANSFORMER_FACTORY.newTransformerHandler();
             Properties properties = new Properties();
@@ -78,9 +81,9 @@
      * @throws IOException if the {@link InputStream} can't be used.
      * @throws SAXException if the {@link InputStream} can't be parsed.
      */
-    public static void toSax(final InputStream inputStream, final SAXConsumer xmlConsumer) throws IOException,
+    public static void toSax(final InputStream inputStream, final ContentHandler contentHandler) throws IOException,
             SAXException {
-        createXMLReader(xmlConsumer).parse(new InputSource(new BufferedInputStream(inputStream)));
+        createXMLReader(contentHandler).parse(new InputSource(new BufferedInputStream(inputStream)));
     }
 
     /**
@@ -91,8 +94,8 @@
      * @throws IOException if the {@link InputStream} can't be used.
      * @throws SAXException if the {@link InputStream} can't be parsed.
      */
-    public static void toSax(final String string, final SAXConsumer xmlConsumer) throws IOException, SAXException {
-        createXMLReader(xmlConsumer).parse(new InputSource(new StringReader(string)));
+    public static void toSax(final String string, final ContentHandler contentHandler) throws IOException, SAXException {
+        createXMLReader(contentHandler).parse(new InputSource(new StringReader(string)));
     }
 
     /**
@@ -103,10 +106,10 @@
      * @param The {@link URLConnection} to be streamed.
      * @param An {@link SAXConsumer} as target.
      */
-    public static void toSax(URLConnection urlConnection, SAXConsumer xmlConsumer) {
+    public static void toSax(final URLConnection urlConnection, final ContentHandler contentHandler) {
         try {
             InputStream inputStream = urlConnection.getInputStream();
-            XMLUtils.toSax(inputStream, xmlConsumer);
+            XMLUtils.toSax(inputStream, contentHandler);
         } catch (PipelineException e) {
             throw e;
         } catch (Exception e) {
@@ -116,12 +119,12 @@
         }
     }
 
-    private static XMLReader createXMLReader(final SAXConsumer xmlConsumer) {
+    public static XMLReader createXMLReader(final ContentHandler contentHandler) {
         XMLReader xmlReader;
         try {
             xmlReader = XMLReaderFactory.createXMLReader();
-            xmlReader.setContentHandler(xmlConsumer);
-            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", xmlConsumer);
+            xmlReader.setContentHandler(contentHandler);
+            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", contentHandler);
             xmlReader.setEntityResolver(new EntityResolver() {
 
                 public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {

Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/component/RequestParametersGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/component/RequestParametersGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/component/RequestParametersGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/component/RequestParametersGenerator.java Wed Feb 11 11:02:54 2009
@@ -45,19 +45,19 @@
         Enumeration<String> parameterNames = request.getParameterNames();
 
         try {
-            this.getXMLConsumer().startDocument();
-            this.getXMLConsumer().startElement("", "request-paramters", "request-paramters", new AttributesImpl());
+            this.getSAXConsumer().startDocument();
+            this.getSAXConsumer().startElement("", "request-paramters", "request-paramters", new AttributesImpl());
 
             while (parameterNames.hasMoreElements()) {
                 String name = parameterNames.nextElement();
                 String value = request.getParameter(name);
-                this.getXMLConsumer().startElement("", name, name, new AttributesImpl());
-                this.getXMLConsumer().characters(value.toCharArray(), 0, value.length());
-                this.getXMLConsumer().endElement("", name, name);
+                this.getSAXConsumer().startElement("", name, name, new AttributesImpl());
+                this.getSAXConsumer().characters(value.toCharArray(), 0, value.length());
+                this.getSAXConsumer().endElement("", name, name);
             }
 
-            this.getXMLConsumer().endElement("", "request-paramters", "request-paramters");
-            this.getXMLConsumer().endDocument();
+            this.getSAXConsumer().endElement("", "request-paramters", "request-paramters");
+            this.getSAXConsumer().endDocument();
         } catch (SAXException e) {
             throw new InvocationException(e);
         }

Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServiceConsumerGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServiceConsumerGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServiceConsumerGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServiceConsumerGenerator.java Wed Feb 11 11:02:54 2009
@@ -47,7 +47,7 @@
         }
 
         try {
-            XMLUtils.toSax(inputStream, this.getXMLConsumer());
+            XMLUtils.toSax(inputStream, this.getSAXConsumer());
         } catch (PipelineException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceGenerator.java Wed Feb 11 11:02:54 2009
@@ -34,7 +34,7 @@
         }
 
         try {
-            XMLUtils.toSax(this.service.openConnection(), this.getXMLConsumer());
+            XMLUtils.toSax(this.service.openConnection(), this.getSAXConsumer());
         } catch (Exception e) {
             throw new ProcessingException("Can't parse " + this.service, e);
         }

Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java Wed Feb 11 11:02:54 2009
@@ -26,19 +26,19 @@
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.util.URLConnectionUtils;
 import org.apache.cocoon.sax.AbstractSAXSerializer;
-import org.apache.cocoon.sax.util.SaxBuffer;
 import org.apache.cocoon.sax.util.XMLUtils;
+import org.apache.cocoon.xml.sax.SAXBuffer;
 import org.apache.commons.io.IOUtils;
 import org.xml.sax.SAXException;
 
 public class ServletServiceSerializer extends AbstractSAXSerializer {
 
     private URL service;
-    private SaxBuffer saxBuffer = new SaxBuffer();
+    private SAXBuffer saxBuffer = new SAXBuffer();
     private URLConnection servletConnection;
 
     public void init() {
-        this.setConsumer(this.saxBuffer);
+        this.setContentHandler(this.saxBuffer);
     }
 
     @Override

Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceTransformer.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceTransformer.java Wed Feb 11 11:02:54 2009
@@ -24,8 +24,8 @@
 
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.sax.AbstractSAXTransformer;
-import org.apache.cocoon.sax.util.SaxBuffer;
 import org.apache.cocoon.sax.util.XMLUtils;
+import org.apache.cocoon.xml.sax.SAXBuffer;
 import org.xml.sax.SAXException;
 
 public class ServletServiceTransformer extends AbstractSAXTransformer {
@@ -36,7 +36,7 @@
     @Override
     public void startDocument() throws SAXException {
         this.startSAXRecording();
-        this.getXMLConsumer().startDocument();
+        this.getSAXConsumer().startDocument();
     }
 
     @Override
@@ -45,12 +45,12 @@
             throw new IllegalArgumentException("ServletServiceTransformer has no service set.");
         }
 
-        this.getXMLConsumer().endDocument();
-        SaxBuffer saxBuffer = this.endSAXRecording();
+        this.getSAXConsumer().endDocument();
+        SAXBuffer saxBuffer = this.endSAXRecording();
 
         try {
             XMLUtils.toOutputStream(this.getUrlConnection().getOutputStream(), saxBuffer);
-            XMLUtils.toSax(this.getUrlConnection(), this.getXMLConsumer());
+            XMLUtils.toSax(this.getUrlConnection(), this.getSAXConsumer());
         } catch (IOException e) {
             throw new ProcessingException("Can't stream SaxBuffer into the output stream of the URL "
                     + this.getUrlConnection().getURL());

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ExceptionGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ExceptionGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ExceptionGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ExceptionGenerator.java Wed Feb 11 11:02:54 2009
@@ -57,9 +57,9 @@
         Throwable throwable = ParameterHelper.getThrowable(this.parameters);
 
         try {
-            this.getXMLConsumer().startDocument();
-            this.toSAX(throwable, this.getXMLConsumer());
-            this.getXMLConsumer().endDocument();
+            this.getSAXConsumer().startDocument();
+            this.toSAX(throwable, this.getSAXConsumer());
+            this.getSAXConsumer().endDocument();
         } catch (SAXException e) {
             throw new ProcessingException("Failed to generate exception document.", e);
         }

Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java Wed Feb 11 11:02:54 2009
@@ -26,6 +26,9 @@
 
 import org.antlr.stringtemplate.AttributeRenderer;
 import org.antlr.stringtemplate.StringTemplate;
+import org.apache.cocoon.pipeline.PipelineException;
+import org.apache.cocoon.pipeline.ProcessingException;
+import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
 import org.apache.cocoon.pipeline.caching.CompoundCacheKey;
 import org.apache.cocoon.pipeline.caching.ParameterCacheKey;
@@ -33,16 +36,18 @@
 import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
 import org.apache.cocoon.pipeline.component.Starter;
 import org.apache.cocoon.sax.AbstractSAXProducer;
+import org.apache.cocoon.sax.util.XMLUtils;
 import org.apache.cocoon.servlet.controller.ControllerContextHelper;
-import org.apache.cocoon.sitemap.util.ExceptionHandler;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
 
 public class StringTemplateGenerator extends AbstractSAXProducer implements Starter, CachingPipelineComponent {
 
+    private final Log logger = LogFactory.getLog(this.getClass());
+
     private URL source;
     private Map<String, Object> parameters = new HashMap<String, Object>();
 
@@ -67,7 +72,7 @@
             cacheKey.addCacheKey(new TimestampCacheKey(this.source, this.source.openConnection().getLastModified()));
             cacheKey.addCacheKey(new ParameterCacheKey(this.parameters));
         } catch (IOException e) {
-            e.printStackTrace();
+            throw new SetupException(e);
         }
 
         return cacheKey;
@@ -84,10 +89,9 @@
         }
 
         try {
-            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
-
-            xmlReader.setContentHandler(this.getXMLConsumer());
-            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", this.getXMLConsumer());
+            if (this.logger.isDebugEnabled()) {
+                this.logger.debug("Using template: " + this.source.toURI().toASCIIString());
+            }
 
             InputStream inputStream = this.source.openStream();
             try {
@@ -101,14 +105,22 @@
                 Map<String, Object> controllerContext = ControllerContextHelper.getContext(this.parameters);
                 for (Entry<String, Object> eachEntry : controllerContext.entrySet()) {
                     stringTemplate.setAttribute(eachEntry.getKey(), eachEntry.getValue());
+
+                    if (this.logger.isDebugEnabled()) {
+                        this.logger.debug("Passing parameter: key=" + eachEntry.getKey() + ", value="
+                                + eachEntry.getValue());
+                    }
                 }
 
-                xmlReader.parse(new InputSource(new StringReader(stringTemplate.toString())));
+                XMLUtils.createXMLReader(this.getSAXConsumer()).parse(
+                        new InputSource(new StringReader(stringTemplate.toString())));
             } finally {
                 IOUtils.closeQuietly(inputStream);
             }
+        } catch (PipelineException e) {
+            throw e;
         } catch (Exception e) {
-            throw ExceptionHandler.getInvocationException(e);
+            throw new ProcessingException("Can't parse url connection " + this.source, e);
         }
     }
 

Modified: cocoon/cocoon3/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/parent/pom.xml?rev=743301&r1=743300&r2=743301&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/parent/pom.xml (original)
+++ cocoon/cocoon3/trunk/parent/pom.xml Wed Feb 11 11:02:54 2009
@@ -129,7 +129,12 @@
         <groupId>org.apache.cocoon</groupId>
         <artifactId>cocoon-jnet</artifactId>
         <version>1.0.0</version>
-      </dependency>            
+      </dependency>     
+      <dependency>
+        <groupId>org.apache.cocoon</groupId>
+        <artifactId>cocoon-xml</artifactId>
+        <version>2.0.0</version>
+      </dependency>	         
 
       <!-- Spring (+ AOP support)-->
       <dependency>



Mime
View raw message