You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beyaRecords <uz...@beyarecords.com> on 2005/01/27 10:59:57 UTC

bit of brotherly help...

Hi,
I was just wondering if there are any cocoon heads out there who have 
access to an I.E browser on an windows platform that can tell me 
whether my site is visible when accessed from the browser?

http://www.beyarecords.com

If you view source in the browser, you will see that I have placed an 
external tag (test) around the html tag, and this tag picks up some xml 
info:

<test xmlns:cinclude="http://apache.org/cocoon/include/1.0">

If I don't place the tag around the html tag I get:

<html xmlns:cinclude="http://apache.org/cocoon/include/1.0">

When this happens none of the javascript will work in any browser on 
MAC OS X, but if I leave the tag in then nothing appears in an IE 
browser.

All xsl pages are being transformed as xsltc and the serialize type is 
xhtml.

What to do?


regards

Uzo



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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
FYI: I use this declaration for my xhtml serialization:

<map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html; charset=utf-8" name="xhtml" 
pool-grow="2" pool-max="64" pool-min="10" src="org.mycompany.cocoon.serialization.XMLSerializer">
      	<doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
      	<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
	<encoding>UTF-8</encoding>
</map:serializer>

Kind Regards,
Jan

beyaRecords wrote:
> 
> On 27 Jan 2005, at 10:43, Jan Hoskens wrote:
> 
>> public class XMLSerializer extends 
>> org.apache.cocoon.serialization.XMLSerializer
>> {
>>
>>     public void endPrefixMapping(String prefix) throws SAXException
>>     {
>>         // do nothing
>>     }
>>
>>     public void startPrefixMapping(String prefix, String uri)
>>             throws SAXException
>>     {
>>         // do nothing
>>     }
>> }
> 
> 
> Hi Jan,
> I like the sound of what you are saying but could you please expand on 
> your explanation?
> 
> So I create my new XMLSerializer class but how do I call it into my 
> sitemap?
> 
> many regards
> 
> Uzo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 11:25, Leszek Gawron wrote:

> <map:serializer logger="sitemap.serializer.myxml" mime-type="text/xml" 
> name="myxml" 
> src="org.apache.cocoon.serialization.MyExtendedXMLSerializer"/>
>
> and then:
>
> <map:serialize type="myxml"/>

Leszek,
got it! Thanks very much for that heads up.

regards

Uzo


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


Re: bit of brotherly help...

Posted by Leszek Gawron <lg...@mobilebox.pl>.
beyaRecords wrote:
> 
> On 27 Jan 2005, at 10:43, Jan Hoskens wrote:
> 
>> public class XMLSerializer extends 
>> org.apache.cocoon.serialization.XMLSerializer
>> {
>>
>>     public void endPrefixMapping(String prefix) throws SAXException
>>     {
>>         // do nothing
>>     }
>>
>>     public void startPrefixMapping(String prefix, String uri)
>>             throws SAXException
>>     {
>>         // do nothing
>>     }
>> }
> 
> 
> Hi Jan,
> I like the sound of what you are saying but could you please expand on 
> your explanation?
> 
> So I create my new XMLSerializer class but how do I call it into my 
> sitemap?
ordinary xml serializer is defined as :

<map:serializer logger="sitemap.serializer.xml" mime-type="text/xml" 
name="xml" src="org.apache.cocoon.serialization.XMLSerializer"/>


so do your own declaration
<map:serializer logger="sitemap.serializer.myxml" mime-type="text/xml" 
name="myxml" src="org.apache.cocoon.serialization.MyExtendedXMLSerializer"/>

and then:

<map:serialize type="myxml"/>

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 10:43, Jan Hoskens wrote:

> public class XMLSerializer extends 
> org.apache.cocoon.serialization.XMLSerializer
> {
>
>     public void endPrefixMapping(String prefix) throws SAXException
>     {
>         // do nothing
>     }
>
>     public void startPrefixMapping(String prefix, String uri)
>             throws SAXException
>     {
>         // do nothing
>     }
> }

Hi Jan,
I like the sound of what you are saying but could you please expand on 
your explanation?

So I create my new XMLSerializer class but how do I call it into my 
sitemap?

many regards

Uzo


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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
beyaRecords wrote:
> 
> On 27 Jan 2005, at 15:25, Jan Hoskens wrote:
> 
>> What about a simple test with a page containing nothing but a few 
>> xmlns namespaces, running it through the html serializer once, check 
>> if there are xmlns (there should be) and then replace that serialzer 
>> by your customserializer and check again(there should be none)?
>>
>> btw, what version of cocoon are u using? (not that it should matter ...)
> 
> 
> Jan,
> firstly i am running cocoon 2.1.6. My xslt file is specified top and 
> bottom as follows:
> 
> <?xml version="1.0" encoding="ISO-8859-1"?>
>     <xsl:stylesheet version="1.0"
>         xmlns:cinclude="http://apache.org/cocoon/include/1.0"
>         xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>         >
>         <xsl:template match="/">
>         <test>
>     
> <html>
> ........
> </html>
> 
> 
>         </test>
>         </xsl:template>
>        
>         <xsl:template match="*">
>               <xsl:element name="{local-name()}">
>                     <xsl:apply-templates select="@*|xmlns|node()"/>
>               </xsl:element>
>         </xsl:template>
> 
>         <xsl:template match="@*|text()" priority="-1">
>               <xsl:copy/>
>         </xsl:template>
>     
>        
>     </xsl:stylesheet>
> 
> Now, as you can see I have 2 xmlns declarations and only the cinclude 
> one appears all the time. So I changed the serializer type to html as 
> you suggested and the xmlns line was still in the final html output!! 
> Should I send my sitemap, xsl, and jxt file to you to have a look?
> 

Sure, send it, I'll take a look, I haven't got time to do it right away, but I can test it tomorrow 
if you like.


Kind Regards,
Jan

> regards
> 
> Uzo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 15:25, Jan Hoskens wrote:

> What about a simple test with a page containing nothing but a few 
> xmlns namespaces, running it through the html serializer once, check 
> if there are xmlns (there should be) and then replace that serialzer 
> by your customserializer and check again(there should be none)?
>
> btw, what version of cocoon are u using? (not that it should matter 
> ...)

Jan,
firstly i am running cocoon 2.1.6. My xslt file is specified top and 
bottom as follows:

<?xml version="1.0" encoding="ISO-8859-1"?>
	<xsl:stylesheet version="1.0"
		xmlns:cinclude="http://apache.org/cocoon/include/1.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		>
		<xsl:template match="/">
		<test>
	
<html>
........
</html>


		</test>
		</xsl:template>
		
		<xsl:template match="*">
			  <xsl:element name="{local-name()}">
					<xsl:apply-templates select="@*|xmlns|node()"/>
			  </xsl:element>
		</xsl:template>

		<xsl:template match="@*|text()" priority="-1">
			  <xsl:copy/>
		</xsl:template>
	
		
	</xsl:stylesheet>

Now, as you can see I have 2 xmlns declarations and only the cinclude 
one appears all the time. So I changed the serializer type to html as 
you suggested and the xmlns line was still in the final html output!! 
Should I send my sitemap, xsl, and jxt file to you to have a look?

regards

Uzo


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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
beyaRecords wrote:
> 
> On 27 Jan 2005, at 14:13, Jan Hoskens wrote:
> 
>> - your custom serializer doesn't contain any super.blablah(..)
>> - the mentioned pipeline is the correct one and is called on its own. 
>> No other pipelines calling/including this one? Try altering the page 
>> to be sure it's the correct one. Check your logs to see where the 
>> sitemap matches your request.
>> - restart the whole bunch (tomcat or whatever you're using) and clear 
>> the workdir if you're cocoon starts acting funny (can help sometimes)
> 
> 
> Jan,
> I have checked all that you mention and there is nothing out of place. 
> hmmmm... puzzling!
> 

Hmm yeah, you got me there... ;-)

If only I could meet that troublemaker head-on, grrr...

What about a simple test with a page containing nothing but a few xmlns namespaces, running it 
through the html serializer once, check if there are xmlns (there should be) and then replace that 
serialzer by your customserializer and check again(there should be none)?

btw, what version of cocoon are u using? (not that it should matter ...)

Kind Regards,
Jan

> regards
> 
> Uzo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 14:13, Jan Hoskens wrote:

> - your custom serializer doesn't contain any super.blablah(..)
> - the mentioned pipeline is the correct one and is called on its own. 
> No other pipelines calling/including this one? Try altering the page 
> to be sure it's the correct one. Check your logs to see where the 
> sitemap matches your request.
> - restart the whole bunch (tomcat or whatever you're using) and clear 
> the workdir if you're cocoon starts acting funny (can help sometimes)

Jan,
I have checked all that you mention and there is nothing out of place. 
hmmmm... puzzling!

regards

Uzo


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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
At first sight, everything should be fine.

A few things you can check:
- your custom serializer doesn't contain any super.blablah(..)
- the mentioned pipeline is the correct one and is called on its own. No other pipelines 
calling/including this one? Try altering the page to be sure it's the correct one. Check your logs 
to see where the sitemap matches your request.
- restart the whole bunch (tomcat or whatever you're using) and clear the workdir if you're cocoon 
starts acting funny (can help sometimes)

I'm using the serializer myself (3 different sites now) and am experiencing no problems concerning 
xmlns namespaces.

Kind Regards,
Jan

beyaRecords wrote:
> 
> 
> On 27 Jan 2005, at 12:26, beyaRecords wrote:
> 
>     done and works a treat. many thanks.
> 
> 
> Ok,
> I have implemented the following:
> 
> <map:serializer logger="sitemap.serializer.xhtml" mime-type="text/html" 
> name="myxml" pool-grow="2" pool-max="64" pool-min="10" 
> src="test.myXMLSerializer">
> <doctype-public>-//W3C//DTD XHTML 1.0 Transitional//EN</doctype-public>
> 
> <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</doctype-system> 
> 
> <encoding>ISO-8859-1</encoding>
> </map:serializer>
> 
> 
> 
> <!-- ========================================= -->
> <!-- Holding page -->
> <!-- ========================================= -->
> <map:match pattern="holding.xml">
> <map:generate type="jx" src="jx/holding.jx"/>
> <map:transform type="xsltc" src="style/holding.xsl"/>
> <map:transform type="cinclude"/>
> <map:serialize type="myxml"/>
> </map:match>
> 
> And still when I view source in the browser I see:
> 
> *xmlns:cinclude="http://apache.org/cocoon/include/1.0"*
> 
> what am I doing wrong here?
> 
> regards
> 
> Uzo


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 12:26, beyaRecords wrote:

> done and works a treat. many thanks.

Ok,
I have implemented the following:

	<map:serializer logger="sitemap.serializer.xhtml"  
mime-type="text/html" name="myxml" pool-grow="2" pool-max="64"  
pool-min="10" src="test.myXMLSerializer">
       <doctype-public>-//W3C//DTD XHTML 1.0  
Transitional//EN</doctype-public>
        
<doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1- 
transitional.dtd</doctype-system>
       <encoding>ISO-8859-1</encoding>
     </map:serializer>



			<!-- ========================================= -->
			<!-- Holding page							   -->
			<!-- ========================================= -->
			<map:match pattern="holding.xml">
				<map:generate type="jx" src="jx/holding.jx"/>
				<map:transform type="xsltc" src="style/holding.xsl"/>
				<map:transform type="cinclude"/>
				<map:serialize type="myxml"/>
			</map:match>

And still when I view source in the browser I see:

xmlns:cinclude="http://apache.org/cocoon/include/1.0"

what am I doing wrong here?

regards

Uzo

Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 12:23, Jan Hoskens wrote:

> Ok, I'll make it easy for you

Jan,
done and works a treat. many thanks.

Uzo


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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
Ok, I'll make it easy for you, just copy this:

package org.yourcompany.cocoon.serialization;

import org.xml.sax.SAXException;

/**
  * A simple serializer, extending XMLSerializer to avoid getting namespaces in
  * output. (Thus only overriding prefixmapping methods to do nothing.)
  *
  * This is most usefull for xhtml outputting.
  *
  */
public class XMLSerializer extends org.apache.cocoon.serialization.XMLSerializer
{

     public void endPrefixMapping(String prefix) throws SAXException
     {
         // do nothing
     }

     public void startPrefixMapping(String prefix, String uri)
             throws SAXException
     {
         // do nothing
     }
}

Then compile with the following jars added to your buildpath:
       avalon-framework-api-4.2.0.jar
       avalon-framework-impl-4.2.0.jar
       cocoon-2.1.5.jar
       excalibur-sourceresolve-2.0.jar
       excalibur-xmlutil-1.0.jar
       excalibur-pool-1.2.jar
       regexp-1.3.jar
I don't know if you need them all (last one probably not, other's not sure as I have other 
transformers/serializers/generators as well). These files can be found in your cocoon/WEB-INF/lib 
directory, possibly with another version.

Kind Regards,
Jan

beyaRecords wrote:
> 
> On 27 Jan 2005, at 10:43, Jan Hoskens wrote:
> 
>> public class XMLSerializer extends 
>> org.apache.cocoon.serialization.XMLSerializer
>> {
>>
>>     public void endPrefixMapping(String prefix) throws SAXException
>>     {
>>         // do nothing
>>     }
>>
>>     public void startPrefixMapping(String prefix, String uri)
>>             throws SAXException
>>     {
>>         // do nothing
>>     }
>> }
> 
> 
> Hi,
> i'm gonna call this class from my own package as so:
> 
> package test
> 
> all I need to know is what package I need to import and what jar file it 
> sits in? so:
> 
> package test
> import ?????
> 
> public class myXMLSerializer extends 
> org.apache.cocoon.serialization.XMLSerializer
> 
> regards
> 
> Uzo
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 12:08, beyaRecords wrote:

> all I need to know is what package I need to import and what jar file 
> it sits in

Sorry,
I meant to say I just need to know what jar file I grab the 
XMLSerializer from? I'm building my class in eclipse hence the need to 
know which jar file specifically I need.

regards

Uzo


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 10:43, Jan Hoskens wrote:

> public class XMLSerializer extends 
> org.apache.cocoon.serialization.XMLSerializer
> {
>
>     public void endPrefixMapping(String prefix) throws SAXException
>     {
>         // do nothing
>     }
>
>     public void startPrefixMapping(String prefix, String uri)
>             throws SAXException
>     {
>         // do nothing
>     }
> }

Hi,
i'm gonna call this class from my own package as so:

package test

all I need to know is what package I need to import and what jar file 
it sits in? so:

package test
import ?????

public class myXMLSerializer extends 
org.apache.cocoon.serialization.XMLSerializer

regards

Uzo


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


Re: bit of brotherly help...

Posted by Jan Hoskens <jh...@schaubroeck.be>.
beyaRecords wrote:
> Hi,
> I was just wondering if there are any cocoon heads out there who have 
> access to an I.E browser on an windows platform that can tell me whether 
> my site is visible when accessed from the browser?
> 
> http://www.beyarecords.com
> 

Yes, I can see your site properly on my winxp with IE6 as well as on firefox!

> If you view source in the browser, you will see that I have placed an 
> external tag (test) around the html tag, and this tag picks up some xml 
> info:
> 
> <test xmlns:cinclude="http://apache.org/cocoon/include/1.0">
> 
> If I don't place the tag around the html tag I get:
> 
> <html xmlns:cinclude="http://apache.org/cocoon/include/1.0">
> 
> When this happens none of the javascript will work in any browser on MAC 
> OS X, but if I leave the tag in then nothing appears in an IE browser.
> 
> All xsl pages are being transformed as xsltc and the serialize type is 
> xhtml.
> 
> What to do?
> 

Well if you experience problems with namespaces popping up in your xhtml you can always remove all 
of them by extending the XMLSerializer:

public class XMLSerializer extends org.apache.cocoon.serialization.XMLSerializer
{

     public void endPrefixMapping(String prefix) throws SAXException
     {
         // do nothing
     }

     public void startPrefixMapping(String prefix, String uri)
             throws SAXException
     {
         // do nothing
     }
}

This way no xmlns:cinclude="http://apache.org/cocoon/include/1.0" will bother your html page.

(I did the same to avoid pages with unreadable xml, containing dozens of xmlns on various elements)

Kind Regards,
Jan

> 
> regards
> 
> Uzo
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


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


Re: bit of brotherly help...

Posted by beyaRecords <uz...@beyarecords.com>.
On 27 Jan 2005, at 10:42, Conal Tuohy wrote:

>  but you could run a stylesheet at the end of your
> pipeline (just before serialization) to strip the cinclude namespace

Hi Con,
thanks for the advice. I will give that a shot.

regards

Uzo


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


RE: bit of brotherly help...

Posted by Conal Tuohy <co...@paradise.net.nz>.
Uzo:

> I was just wondering if there are any cocoon heads out there who have
> access to an I.E browser on an windows platform that can tell me
> whether my site is visible when accessed from the browser?
>
> http://www.beyarecords.com

It does appear. So that means it the cinclude namespace is causing a
problem?

> All xsl pages are being transformed as xsltc and the
> serialize type is
> xhtml.

I don't know if you can configure the cinclude transformer to remove the
namespace (possibly?), but you could run a stylesheet at the end of your
pipeline (just before serialization) to strip the cinclude namespace. HTH.

Con


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