cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jo...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation HTMLGenerator.java
Date Fri, 31 Oct 2003 13:09:10 GMT
joerg       2003/10/31 05:09:10

  Modified:    src/blocks/html/java/org/apache/cocoon/generation
                        HTMLGenerator.java
  Log:
  applied changes for avoiding code duplication suggested by Alfred Fuchs
  
  Revision  Changes    Path
  1.10      +7 -10     cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation/HTMLGenerator.java
  
  Index: HTMLGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/html/java/org/apache/cocoon/generation/HTMLGenerator.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- HTMLGenerator.java	10 Oct 2003 12:06:22 -0000	1.9
  +++ HTMLGenerator.java	31 Oct 2003 13:09:10 -0000	1.10
  @@ -317,26 +317,23 @@
                  getLogger().warn(stringWriter.toString());
               }
   
  +            DOMStreamer domStreamer = new DOMStreamer(this.contentHandler,
  +                                                      this.lexicalHandler);
  +            this.contentHandler.startDocument();
   
               if(xpath != null) {
  -                DOMStreamer domStreamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
  -
  -                contentHandler.startDocument();
                   NodeList nl = processor.selectNodeList(doc, xpath);
                   int length = nl.getLength();
  -                for(int i=0;i<length;i++) {
  +                for(int i=0; i < length; i++) {
                       domStreamer.stream(nl.item(i));
                   }
  -                contentHandler.endDocument();
               } else {
  -                DOMStreamer streamer = new DOMStreamer(this.contentHandler,this.lexicalHandler);
                   // If the HTML document contained a <?xml ... declaration, tidy would
have recognized
                   // this as a processing instruction (with a 'null' target), giving problems
further
                   // on in the pipeline. Therefore we only serialize the document element.
  -                this.contentHandler.startDocument();
  -                streamer.stream(doc.getDocumentElement());
  -                this.contentHandler.endDocument();
  +                domStreamer.stream(doc.getDocumentElement());
               }
  +            this.contentHandler.endDocument();
           } catch (IOException e){
               throw new ResourceNotFoundException("Could not get resource "
                   + this.inputSource.getURI(), e);
  
  
  

Mime
View raw message