You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by di...@locus.apache.org on 2000/11/14 22:52:06 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/transformation XIncludeTransformer.java XalanTransformer.java

dims        00/11/14 13:52:05

  Modified:    src/org/apache/cocoon/components/language/markup Tag:
                        xml-cocoon2 LogicsheetCodeGenerator.java
               src/org/apache/cocoon/transformation Tag: xml-cocoon2
                        XIncludeTransformer.java XalanTransformer.java
  Log:
  Moving to latest Xalan (Nov 14 - 4:50 EST)
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.8   +25 -30    xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/LogicsheetCodeGenerator.java
  
  Index: LogicsheetCodeGenerator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/Attic/LogicsheetCodeGenerator.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- LogicsheetCodeGenerator.java	2000/11/10 12:32:01	1.1.2.7
  +++ LogicsheetCodeGenerator.java	2000/11/14 21:52:05	1.1.2.8
  @@ -17,10 +17,10 @@
   
   import java.io.IOException;
   
  -import org.apache.serialize.SerializerFactory;
  -import org.apache.serialize.Method;
  -import org.apache.serialize.Serializer;
  -import org.apache.serialize.OutputFormat;
  +import org.apache.xalan.serialize.SerializerFactory;
  +import org.apache.xalan.serialize.Method;
  +import org.apache.xalan.serialize.Serializer;
  +import org.apache.xalan.serialize.OutputFormat;
   
   import javax.xml.transform.sax.TransformerHandler;
   import javax.xml.transform.sax.SAXResult;
  @@ -31,7 +31,7 @@
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/11/10 12:32:01 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/11/14 21:52:05 $
    */
   public class LogicsheetCodeGenerator implements MarkupCodeGenerator {
   
  @@ -77,31 +77,26 @@
       * @param logicsheet The logicsheet to be added
       */
       public void addLogicsheet(Logicsheet logicsheet) {
  -        try {
  -            if (this.currentParent==null) {
  -                // Setup the first transformer of the chain.
  -                this.currentParent = logicsheet.getTransformerHandler();
  -
  -                // the parent is the rootReader
  -                this.rootReader.setContentHandler(this.currentParent);;
  -
  -                // Set content handler for the end of the chain : serializer
  -                this.currentParent.setResult(new SAXResult(this.serializerContentHandler));
  -
  -            } else {
  -                // Build the transformer chain on the fly
  -                TransformerHandler newParent=logicsheet.getTransformerHandler();
  -
  -                // the currentParent is the parent of the new logicsheet filter
  -                this.currentParent.setResult(new SAXResult(newParent));
  -
  -                // reset the new parent and the contentHanlder
  -                this.currentParent = newParent;
  -                this.currentParent.setResult(new SAXResult(this.serializerContentHandler));
  -            }
  -        } catch (TransformerException e) {
  -            // FIXME (DIMS) - Need to handle exceptions gracefully.
  -            e.printStackTrace();
  +        if (this.currentParent==null) {
  +            // Setup the first transformer of the chain.
  +            this.currentParent = logicsheet.getTransformerHandler();
  +
  +            // the parent is the rootReader
  +            this.rootReader.setContentHandler(this.currentParent);;
  +
  +            // Set content handler for the end of the chain : serializer
  +            this.currentParent.setResult(new SAXResult(this.serializerContentHandler));
  +
  +        } else {
  +            // Build the transformer chain on the fly
  +            TransformerHandler newParent=logicsheet.getTransformerHandler();
  +
  +            // the currentParent is the parent of the new logicsheet filter
  +            this.currentParent.setResult(new SAXResult(newParent));
  +
  +            // reset the new parent and the contentHanlder
  +            this.currentParent = newParent;
  +            this.currentParent.setResult(new SAXResult(this.serializerContentHandler));
           }
       }   
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.12  +20 -13    xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XIncludeTransformer.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- XIncludeTransformer.java	2000/11/10 22:38:55	1.1.2.11
  +++ XIncludeTransformer.java	2000/11/14 21:52:05	1.1.2.12
  @@ -38,6 +38,8 @@
   import org.apache.log.LogKit;
   import org.apache.log.Logger;
   
  +import javax.xml.transform.TransformerException;
  +
   /**
    * My first pass at an XInclude transformation. Currently it should set the base URI
    * from the SAX Locator's system id but allow it to be overridden by xml:base
  @@ -46,7 +48,7 @@
    * by the SAX event FSM yet.
    *
    * @author <a href="mailto:balld@webslingerZ.com">Donald Ball</a>
  - * @version CVS $Revision: 1.1.2.11 $ $Date: 2000/11/10 22:38:55 $ $Author: bloritsch $
  + * @version CVS $Revision: 1.1.2.12 $ $Date: 2000/11/14 21:52:05 $ $Author: dims $
    */
   public class XIncludeTransformer extends AbstractTransformer implements Composer {
   
  @@ -206,14 +208,14 @@
               }
           } else if (parse.equals("xml")) {
               log.debug("Parse type is XML");
  -	    Parser parser = null;
  -	    try {
  -	        log.debug("Looking up " + Roles.PARSER);
  +	        Parser parser = null;
  +	        try {
  +	            log.debug("Looking up " + Roles.PARSER);
                   parser = (Parser)manager.lookup(Roles.PARSER);
  -	    } catch (Exception e) {
  -	        log.error("Could not find component", e);
  -		return;
  -	    }
  +	        } catch (Exception e) {
  +	            log.error("Could not find component", e);
  +    		    return;
  +	        }
               InputSource input;
               if (object instanceof Reader) {
                   input = new InputSource((Reader)object);
  @@ -230,11 +232,16 @@
                   parser.setLexicalHandler(builder);
                   parser.parse(input);
                   Document document = builder.getDocument();
  -                NodeList list = XPathAPI.selectNodeList(document,xpath);
  -                DOMStreamer streamer = new DOMStreamer(super.contentHandler,super.lexicalHandler);
  -                int length = list.getLength();
  -                for (int i=0; i<length; i++) {
  -                    streamer.stream(list.item(i));
  +                try {
  +                    NodeList list = XPathAPI.selectNodeList(document,xpath);
  +                    DOMStreamer streamer = new DOMStreamer(super.contentHandler,super.lexicalHandler);
  +                    int length = list.getLength();
  +                    for (int i=0; i<length; i++) {
  +                        streamer.stream(list.item(i));
  +                    }
  +                } catch (TransformerException e){
  +	                log.error("TransformerException", e);
  +    		        return;
                   }
               } else {
                   XIncludeContentHandler xinclude_handler = new XIncludeContentHandler(super.contentHandler,super.lexicalHandler);
  
  
  
  1.1.2.23  +2 -7      xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java
  
  Index: XalanTransformer.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/transformation/Attic/XalanTransformer.java,v
  retrieving revision 1.1.2.22
  retrieving revision 1.1.2.23
  diff -u -r1.1.2.22 -r1.1.2.23
  --- XalanTransformer.java	2000/11/11 13:46:09	1.1.2.22
  +++ XalanTransformer.java	2000/11/14 21:52:05	1.1.2.23
  @@ -54,7 +54,7 @@
    *         (Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:dims@yahoo.com">Davanum Srinivas</a>
    * @author <a href="mailto:cziegeler@sundn.de">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.1.2.22 $ $Date: 2000/11/11 13:46:09 $
  + * @version CVS $Revision: 1.1.2.23 $ $Date: 2000/11/14 21:52:05 $
    */
   public class XalanTransformer extends ContentHandlerWrapper
   implements Transformer, Composer, Poolable, Configurable {
  @@ -223,12 +223,7 @@
        * accessing the protected <code>super.contentHandler</code> field.
        */
       public void setContentHandler(ContentHandler content) {
  -        try {
  -            transformerHandler.setResult(new SAXResult(content));
  -        } catch (TransformerException e){
  -            // FIXME (DIMS) - Need to handle exceptions gracefully.
  -            e.printStackTrace();
  -        }
  +        transformerHandler.setResult(new SAXResult(content));
       }
   
       /**