You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Paul Lamb <pa...@oil-law.com> on 2001/04/05 16:57:42 UTC

[C2] Patch was RE: [C2] HTML Serializer

I had time last night to find this bug. The recycle in
AbstractTextSerializer has a format = new format(); that should be
removed. Since the configuration of the component is stored in the
format object, this shouldn't be destroyed during the recycle.

Paul

Index: AbstractTextSerializer.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon/src/org/apache/cocoon/serialization/Attic/Abs
tractTextSerializer.java,v
retrieving revision 1.1.2.9
diff -u -r1.1.2.9 AbstractTextSerializer.java
--- AbstractTextSerializer.java	2001/03/15 22:08:50	1.1.2.9
+++ AbstractTextSerializer.java	2001/04/05 14:50:44
@@ -89,7 +89,6 @@
      * Recycle serializer by removing references
      */
     public void recycle() {
-        this.format = new Properties();
         super.recycle();
     }
 }

> 
> I think I may have actually found a bug...
> 
> In trying to track this down I simply added a logging message in
> HTMLSerializer just before the setOutputProperties(format) to 
> output the
> format.
> 
> Sometimes I get:
> 
> DEBUG   37029   [cocoon  ] (HttpProcessor[80][4]):
> HTMLSerializer.setOutputStream(), format:{indent=yes, version=4.0,
> doctype-system=http://www.w3.org/TR/REC-html40/strict.dtd,
> encoding=UTF-8, doctype-public=-//W3C//DTD HTML 4.0//EN, method=html}
> 
> But other times I get:
> 
> DEBUG   19733   [cocoon  ] (HttpProcessor[80][3]):
> HTMLSerializer.setOutputStream(), format:{method=html}
> 
> I've removed the default "html" serializer from the sitemap 
> and added my
> own, "html-strict", and set it to be the default.
> 
>    <map:serializer name="html-strict"   mime-type="text/html"
>     src="org.apache.cocoon.serialization.HTMLSerializer">
>          <doctype-public>-//W3C//DTD HTML 4.0//EN</doctype-public>
>  
> <doctype-system>http://www.w3.org/TR/REC-html40/strict.dtd</do
> ctype-syst
> em>
>          <encoding>UTF-8</encoding>
>          <indent>yes</indent>
>          <method>html</method>
>          <indent>yes</indent>
>          <version>4.0</version>
>    </map:serializer>
> 
> Paul
> > 
> > Oops!!! My mistake. Yes, the changes should be in sitemap.xmap
> > 
> > Thanks Giacomo.
> > -- dims
> > 
> > --- Giacomo Pati <gi...@apache.org> wrote:
> > > *This message was transferred with a trial version of 
> > CommuniGate(tm) Pro*
> > > Quoting Davanum Srinivas <di...@yahoo.com>:
> > > 
> > > > Paul,
> > > > 
> > > > You can specify some properties for the HTML 
> serializers. For more
> > > > information, please take a look
> > > > at
> > > > 1.
> > > > 
> > http://xml.apache.org/xalan-j/apidocs/javax/xml/transform/Outp
> > utKeys.html
> > > > 2. AbstractTextSerializer.java and HTMLSerializer.java
> > > > 
> > > > You will need to adjust the map:serializer for html in 
> > cocoon.xconf to
> > > > set the parameters.
> > > 
> > > I think you mean sitemap.xmap instead of cocoon.xconf, right?
> > > 
> > > Giacomo
> > > 
> > > > 
> > > > Thanks,
> > > > dims
> > > > 
> > > > --- Paul Lamb <pa...@oil-law.com> wrote:
> > > > > I've been porting a C1 project over to C2 and have 
> > started cleaning up
> > > > > the loose ends, but I seem to be having problems 
> > getting the HTML
> > > > > serializer to produce the same output that C1 did.
> > > > > 
> > > > > I'm using the latest C2 from CVS and I've added the following
> > > > serializer
> > > > > in the sitemap and set it
> > > > > to be the serializer used.
> > > > > 
> > > > > <map:serializer name="html-strict"   mime-type="text/html"
> > > > >   src="org.apache.cocoon.serialization.HTMLSerializer">
> > > > >   <doctype-public>-//W3C//DTD HTML 4.0//EN</doctype-public>
> > > > >  
> > > > >
> > > > 
> > <doctype-system>http://www.w3.org/TR/REC-html40/strict.dtd</do
> > ctype-syst
> > > > > em>
> > > > >   <encoding>UTF-8</encoding>
> > > > > </map:serializer>
> > > > > 
> > > > > 
> > > > > Problem 1: The <DTD...> doesn't always show up in the 
> > resulting html
> > > > > file. It will usually be there on the first access, 
> but after a
> > > > refresh
> > > > > it's gone.
> > > > > 
> > > > > Problem 2: The resulting HTML is formatted horribly, 
> > compared to the
> > > > > same output w/ C1. I'm using the same xsp and xsl files 
> > for both C1 &
> > > > > C2. With C2 I seem to have lots of extra 
> > whitespace--tabs, spaces and
> > > > > new lines.
> > > > > 
> > > > > The main problem with the formatting is that I have a 
> > <br> that should
> > > > > come immediately after an <image...> tag. But with C2 
> > I'm getting
> > > > > <img....>\n\t\t\t<br>\n.
> > > > > 
> > > > > Outside these two problem, I'm amazed at how well C2 
> > works. I can't
> > > > > believe the speed that I'm seeing, even without it 
> > having a cache.
> > > > > 
> > > > > Paul Lamb
> > > > > 
> > > > > 
> > 
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > > > 
> > > > 
> > > > 
> > > > =====
> > > > Davanum Srinivas, JNI-FAQ Manager
> > > > http://www.jGuru.com/faq/JNI
> > > > 
> > > > __________________________________________________
> > > > Do You Yahoo!?
> > > > Get email at your own domain with Yahoo! Mail. 
> > > > http://personal.mail.yahoo.com/
> > > > 
> > > > 
> > 
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > 
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > 
> > 
> > =====
> > Davanum Srinivas, JNI-FAQ Manager
> > http://www.jGuru.com/faq/JNI
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Get email at your own domain with Yahoo! Mail. 
> > http://personal.mail.yahoo.com/
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> > 
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Patch was RE: [C2] HTML Serializer

Posted by Berin Loritsch <bl...@apache.org>.
Paul Lamb wrote:
> 
> I had time last night to find this bug. The recycle in
> AbstractTextSerializer has a format = new format(); that should be
> removed. Since the configuration of the component is stored in the
> format object, this shouldn't be destroyed during the recycle.
> 
> Paul
> 
> Index: AbstractTextSerializer.java
> ===================================================================
> RCS file:
> /home/cvspublic/xml-cocoon/src/org/apache/cocoon/serialization/Attic/Abs
> tractTextSerializer.java,v
> retrieving revision 1.1.2.9
> diff -u -r1.1.2.9 AbstractTextSerializer.java
> --- AbstractTextSerializer.java 2001/03/15 22:08:50     1.1.2.9
> +++ AbstractTextSerializer.java 2001/04/05 14:50:44
> @@ -89,7 +89,6 @@
>       * Recycle serializer by removing references
>       */
>      public void recycle() {
> -        this.format = new Properties();
>          super.recycle();
>      }
>  }

Thanks Paul.  Your patch has been applied.

> 
> >
> > I think I may have actually found a bug...
> >
> > In trying to track this down I simply added a logging message in
> > HTMLSerializer just before the setOutputProperties(format) to
> > output the
> > format.
> >
> > Sometimes I get:
> >
> > DEBUG   37029   [cocoon  ] (HttpProcessor[80][4]):
> > HTMLSerializer.setOutputStream(), format:{indent=yes, version=4.0,
> > doctype-system=http://www.w3.org/TR/REC-html40/strict.dtd,
> > encoding=UTF-8, doctype-public=-//W3C//DTD HTML 4.0//EN, method=html}
> >
> > But other times I get:
> >
> > DEBUG   19733   [cocoon  ] (HttpProcessor[80][3]):
> > HTMLSerializer.setOutputStream(), format:{method=html}
> >
> > I've removed the default "html" serializer from the sitemap
> > and added my
> > own, "html-strict", and set it to be the default.
> >
> >    <map:serializer name="html-strict"   mime-type="text/html"
> >     src="org.apache.cocoon.serialization.HTMLSerializer">
> >          <doctype-public>-//W3C//DTD HTML 4.0//EN</doctype-public>
> >
> > <doctype-system>http://www.w3.org/TR/REC-html40/strict.dtd</do
> > ctype-syst
> > em>
> >          <encoding>UTF-8</encoding>
> >          <indent>yes</indent>
> >          <method>html</method>
> >          <indent>yes</indent>
> >          <version>4.0</version>
> >    </map:serializer>
> >
> > Paul
> > >
> > > Oops!!! My mistake. Yes, the changes should be in sitemap.xmap
> > >
> > > Thanks Giacomo.
> > > -- dims
> > >
> > > --- Giacomo Pati <gi...@apache.org> wrote:
> > > > *This message was transferred with a trial version of
> > > CommuniGate(tm) Pro*
> > > > Quoting Davanum Srinivas <di...@yahoo.com>:
> > > >
> > > > > Paul,
> > > > >
> > > > > You can specify some properties for the HTML
> > serializers. For more
> > > > > information, please take a look
> > > > > at
> > > > > 1.
> > > > >
> > > http://xml.apache.org/xalan-j/apidocs/javax/xml/transform/Outp
> > > utKeys.html
> > > > > 2. AbstractTextSerializer.java and HTMLSerializer.java
> > > > >
> > > > > You will need to adjust the map:serializer for html in
> > > cocoon.xconf to
> > > > > set the parameters.
> > > >
> > > > I think you mean sitemap.xmap instead of cocoon.xconf, right?
> > > >
> > > > Giacomo
> > > >
> > > > >
> > > > > Thanks,
> > > > > dims
> > > > >
> > > > > --- Paul Lamb <pa...@oil-law.com> wrote:
> > > > > > I've been porting a C1 project over to C2 and have
> > > started cleaning up
> > > > > > the loose ends, but I seem to be having problems
> > > getting the HTML
> > > > > > serializer to produce the same output that C1 did.
> > > > > >
> > > > > > I'm using the latest C2 from CVS and I've added the following
> > > > > serializer
> > > > > > in the sitemap and set it
> > > > > > to be the serializer used.
> > > > > >
> > > > > > <map:serializer name="html-strict"   mime-type="text/html"
> > > > > >   src="org.apache.cocoon.serialization.HTMLSerializer">
> > > > > >   <doctype-public>-//W3C//DTD HTML 4.0//EN</doctype-public>
> > > > > >
> > > > > >
> > > > >
> > > <doctype-system>http://www.w3.org/TR/REC-html40/strict.dtd</do
> > > ctype-syst
> > > > > > em>
> > > > > >   <encoding>UTF-8</encoding>
> > > > > > </map:serializer>
> > > > > >
> > > > > >
> > > > > > Problem 1: The <DTD...> doesn't always show up in the
> > > resulting html
> > > > > > file. It will usually be there on the first access,
> > but after a
> > > > > refresh
> > > > > > it's gone.
> > > > > >
> > > > > > Problem 2: The resulting HTML is formatted horribly,
> > > compared to the
> > > > > > same output w/ C1. I'm using the same xsp and xsl files
> > > for both C1 &
> > > > > > C2. With C2 I seem to have lots of extra
> > > whitespace--tabs, spaces and
> > > > > > new lines.
> > > > > >
> > > > > > The main problem with the formatting is that I have a
> > > <br> that should
> > > > > > come immediately after an <image...> tag. But with C2
> > > I'm getting
> > > > > > <img....>\n\t\t\t<br>\n.
> > > > > >
> > > > > > Outside these two problem, I'm amazed at how well C2
> > > works. I can't
> > > > > > believe the speed that I'm seeing, even without it
> > > having a cache.
> > > > > >
> > > > > > Paul Lamb
> > > > > >
> > > > > >
> > >
> > ---------------------------------------------------------------------
> > > > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > > > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > > > >
> > > > >
> > > > >
> > > > > =====
> > > > > Davanum Srinivas, JNI-FAQ Manager
> > > > > http://www.jGuru.com/faq/JNI
> > > > >
> > > > > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Get email at your own domain with Yahoo! Mail.
> > > > > http://personal.mail.yahoo.com/
> > > > >
> > > > >
> > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > >
> > >
> > > =====
> > > Davanum Srinivas, JNI-FAQ Manager
> > > http://www.jGuru.com/faq/JNI
> > >
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Get email at your own domain with Yahoo! Mail.
> > > http://personal.mail.yahoo.com/
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > > For additional commands, email: cocoon-dev-help@xml.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> > For additional commands, email: cocoon-dev-help@xml.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Re: [C2] Patch was RE: [C2] HTML Serializer

Posted by Stuart Roebuck <st...@adolos.co.uk>.
Thank you Paul,

I think that will have solved the output madness I've been experiencing 
lately!

Stuart.

On Thursday, April 5, 2001, at 03:57  pm, Paul Lamb wrote:

> I had time last night to find this bug. The recycle in
> AbstractTextSerializer has a format = new format(); that should be
> removed. Since the configuration of the component is stored in the
> format object, this shouldn't be destroyed during the recycle.
>
> Paul


-------------------------------------------------------------------------
Stuart Roebuck                                  stuart.roebuck@adolos.com
Lead Developer                               Java, XML, MacOS X, XP, etc.
ADOLOS                                             http://www.adolos.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org