You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "Volkm@r" <pl...@arcor.de> on 2004/10/12 07:36:14 UTC

Re: Can't get the xml declaration in the output

IceT wrote:
> Hello,
> 
>       Every time I output something with Cocoon, it omits the 
> xml-declaration. Can anybody help me?

Looks like it doesn't use your xml serializer at all.
Does cocoon send mimetype "text/xml" as you've configured the xml 
serializer? You can check it with Firefox =>Tools =>Info.

If so, it should of course use your configuration. If not, there are 
some points where you could try to improve.

1.  Your sitemap should have only one serializer name="html" but
     you got two of them.

2.  And your map:serializers section should have a default
     serializer like <map:serializers default="YourChoice">

3.  In XSLT, when working with Cocoon, you shouldn't use <xsl:output />
     since this is controlled by the serializer's configuration.

Another (off topic) question: Could you tell me why everybody abides by 
(Western encoding) iso-8859-1 instead of simply always using utf-8 which 
is the default encoding for XML? AFAIK *all* common browsers are 
supporting Unicode encoded with utf-8.
-- 
Volkm@r


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


Re: Problem with StreamGenerator

Posted by Art Spassky <ar...@dgma.donetsk.ua>.
With UTF-8 I have the same result.

I think the problem may be in how servlet container handle uploaded files.
I change encoding in web.xml but have the same result.

may be Jetty is not perfect servlet container or it is a bug.

Thank you once more for reply.

----- Original Message -----
From: "Volkm@r" <pl...@arcor.de>
To: <us...@cocoon.apache.org>
Sent: Tuesday, October 12, 2004 1:54 PM
Subject: Re: Problem with StreamGenerator


> Art Spassky wrote:
> > Hi all.
> >
> > Can someoneb help me with my problem.
> > I am using cocoon-2.1.5.1.
> > I would like to use StreamGenerator for automatical generating documents
> > from uploaded files.
> > everything works well but I found problem with encoding.
> > When I upload xml file with encoding UTF-8 and transform it. Output file
> > contains irregular data.
> >
> > Thank you for help in advance.
> >
> > UploadForm.xml
> >
> > <?xml version="1.0" encoding="Windows-1251"?>
> > <html>
> > <meta name="Content-Type" Value="text/html;charset=UTF-8"/>
>
> So you have
>
> 1. An XML declaration saying "Windows-1251"
> 2. A meta hack saying "UTF-8"
>
> Both should be the same and both *must* be in accordance with the
> charset info of the HTTP response header. As you are obviously using
> Cyrillic, you'd better chose the XML standard encoding which is UTF-8.
>
> Check the mime-type attribute of your HTML serializer to be
>
>     mime-type="text/html; charset=utf-8"
>
> so that it will put the correct header.
> --
> Volkm@r
>
>
> ---------------------------------------------------------------------
> 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: Problem with StreamGenerator2

Posted by Art Spasky <ar...@dgma.donetsk.ua>.
> It perfectly works. But what can we use it for? Just only for viewing
> uploaded files?
Not only for that. You can organize Service to translate Xml files from one
schema to another.

Do you have ICQ? If you have, please send me on my e-mail


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


Re: Problem with StreamGenerator2

Posted by "Volkm@r" <pl...@arcor.de>.
Art Spassky wrote:
> Thank you very much.
> You help me a lot. 
> I found useful web page
> http://wiki.apache.org/cocoon/RequestParameterEncoding
> 
> The problem is solved !!!

I've also played around with the sample from
   "http://localhost:8080/cocoon/samples/stream/uploadfile"
but couldn't find anything wrong. It turned out that 
RequestParameterEncoding didn't need any changes.

Just download both files from here and put them into an empty mountable 
subdirectory. It's Cocoon's sample in a very simplified form.

   http://home.arcor.de/plsdontreply/streamupload/

It perfectly works. But what can we use it for? Just only for viewing 
uploaded files?
-- 
Volkm@r


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


Re: Problem with StreamGenerator2

Posted by Art Spassky <ar...@dgma.donetsk.ua>.
Thank you very much.
You help me a lot. 
I found useful web page
http://wiki.apache.org/cocoon/RequestParameterEncoding

The problem is solved !!!

----- Original Message ----- 
From: "Volkm@r" <pl...@arcor.de>
To: <us...@cocoon.apache.org>
Sent: Tuesday, October 12, 2004 4:43 PM
Subject: Re: Problem with StreamGenerator2


> Art Spassky wrote:
> > I think it is a bug. Or I am not completly understand encodings.
> > 
> > I use standard sample of StreamGenerator at
> > http://localhost:8888/samples/stream/uploadfile
> > 
> > I change its sitemap.xmap with the following
> > 
> > <map:components>
> >   <map:serializers default="html">
> >    <map:serializer name="html" mime-type="text/html; charset=UTF-8"
> >   src="org.apache.cocoon.serialization.HTMLSerializer">
> >      <encoding>UTF-8</encoding>
> >    </map:serializer>
> >   </map:serializers>
> > 
> > </map:components>
> > 
> > When I upload xml file without cyrilic symbols all works well. Problems
> > begin when I use them.
> 
> What about sending Cyrillic (or other utf-8) text in a simple form 
> field, does that work? If not you might read
> <http://www.mail-archive.com/users@cocoon.apache.org/msg19326.html>
> (please read the whole thread!) and
> <http://wiki.apache.org/cocoon/RequestParameterEncoding>
> 
> Sorry if this wouldn't help either. It is about form encoding but 
> uploading files shouldn't be too far away from that.
> -- 
> Volkm@r
> 
> 
> ---------------------------------------------------------------------
> 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: Problem with StreamGenerator2

Posted by "Volkm@r" <pl...@arcor.de>.
Art Spassky wrote:
> I think it is a bug. Or I am not completly understand encodings.
> 
> I use standard sample of StreamGenerator at
> http://localhost:8888/samples/stream/uploadfile
> 
> I change its sitemap.xmap with the following
> 
> <map:components>
>   <map:serializers default="html">
>    <map:serializer name="html" mime-type="text/html; charset=UTF-8"
>   src="org.apache.cocoon.serialization.HTMLSerializer">
>      <encoding>UTF-8</encoding>
>    </map:serializer>
>   </map:serializers>
> 
> </map:components>
> 
> When I upload xml file without cyrilic symbols all works well. Problems
> begin when I use them.

What about sending Cyrillic (or other utf-8) text in a simple form 
field, does that work? If not you might read
<http://www.mail-archive.com/users@cocoon.apache.org/msg19326.html>
(please read the whole thread!) and
<http://wiki.apache.org/cocoon/RequestParameterEncoding>

Sorry if this wouldn't help either. It is about form encoding but 
uploading files shouldn't be too far away from that.
-- 
Volkm@r


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


Re: Problem with StreamGenerator2

Posted by Art Spassky <ar...@dgma.donetsk.ua>.
I think it is a bug. Or I am not completly understand encodings.

I use standard sample of StreamGenerator at
http://localhost:8888/samples/stream/uploadfile

I change its sitemap.xmap with the following

<map:components>
  <map:serializers default="html">
   <map:serializer name="html" mime-type="text/html; charset=UTF-8"
  src="org.apache.cocoon.serialization.HTMLSerializer">
     <encoding>UTF-8</encoding>
   </map:serializer>
  </map:serializers>

</map:components>

When I upload xml file without cyrilic symbols all works well. Problems
begin when I use them.


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


Re: Problem with StreamGenerator

Posted by "Volkm@r" <pl...@arcor.de>.
Art Spassky wrote:
> Hi all.
> 
> Can someoneb help me with my problem.
> I am using cocoon-2.1.5.1.
> I would like to use StreamGenerator for automatical generating documents
> from uploaded files.
> everything works well but I found problem with encoding.
> When I upload xml file with encoding UTF-8 and transform it. Output file
> contains irregular data.
> 
> Thank you for help in advance.
> 
> UploadForm.xml
> 
> <?xml version="1.0" encoding="Windows-1251"?>
> <html>
> <meta name="Content-Type" Value="text/html;charset=UTF-8"/>

So you have

1. An XML declaration saying "Windows-1251"
2. A meta hack saying "UTF-8"

Both should be the same and both *must* be in accordance with the 
charset info of the HTTP response header. As you are obviously using 
Cyrillic, you'd better chose the XML standard encoding which is UTF-8.

Check the mime-type attribute of your HTML serializer to be

    mime-type="text/html; charset=utf-8"

so that it will put the correct header.
-- 
Volkm@r


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


Problem with StreamGenerator

Posted by Art Spassky <ar...@dgma.donetsk.ua>.
Hi all.

Can someoneb help me with my problem.
I am using cocoon-2.1.5.1.
I would like to use StreamGenerator for automatical generating documents
from uploaded files.
everything works well but I found problem with encoding.
When I upload xml file with encoding UTF-8 and transform it. Output file
contains irregular data.

Thank you for help in advance.

UploadForm.xml

<?xml version="1.0" encoding="Windows-1251"?>
<html>
<meta name="Content-Type" Value="text/html;charset=UTF-8"/>
<page>
 <title></title>
 <content>
 Привет
 <form name="UploadForm" method="post" action="submit"
enctype="multipart/form-data">
  <input type="file" name="Foo"/>
  <input id="submit1" name="submit1" type="submit" value="Submit"/>
 </form>
 </content>
</page>
</html>

extract from xslt file

<?xml version="1.0" encoding="Windows-1251"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 version="1.0">
<xsl:output encoding="UTF-8" indent="yes" method="xml"/>
<xsl:template match="/">
.........
</xsl:template>
</xsl:stylesheet>

Extract from sitemap.xmap

 <map:match pattern="UploadForm.html">
     <map:generate src="UploadForm.xml"/>
     <map:serialize/>
 </map:match>

 <map:match pattern="submit">
  <map:act type="">
       <map:parameter name="Cache-Control" value="max-age=0"/>
      <map:generate type="stream">
         <map:parameter name="form-name" value="Foo"/>
      </map:generate>
     <map:serialize type="xml"/>
  </map:act>
 </map:match>


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


Re: Can't get the xml declaration in the output

Posted by IceT <ic...@yahoo.com.br>.
Hello, sorry for the delay. First, people doesn't use UTF-8 because it 
doesn't support accentuation well.

Second, the problem I was having is due to the cache. Even thought I 
tried to disable it, and I also reseted the machine, only by clearing it 
the desired result would be outputed. And it must be cleared EVERY time 
I change the serializer from xml to html, an vice versa. It is weird 
that only this xml declaration thing is affected. When I changed the 
content, everything was fine. the result would immediately show up.

I will have to test this some more to find out what can I do to solve 
this behavior.

Thanks for the help everybody.

Volkm@r wrote:

> IceT wrote:
>
>> Hello,
>>
>>       Every time I output something with Cocoon, it omits the 
>> xml-declaration. Can anybody help me?
>
>
> Looks like it doesn't use your xml serializer at all.
> Does cocoon send mimetype "text/xml" as you've configured the xml 
> serializer? You can check it with Firefox =>Tools =>Info.
>
> If so, it should of course use your configuration. If not, there are 
> some points where you could try to improve.
>
> 1.  Your sitemap should have only one serializer name="html" but
>     you got two of them.
>
> 2.  And your map:serializers section should have a default
>     serializer like <map:serializers default="YourChoice">
>
> 3.  In XSLT, when working with Cocoon, you shouldn't use <xsl:output />
>     since this is controlled by the serializer's configuration.
>
> Another (off topic) question: Could you tell me why everybody abides 
> by (Western encoding) iso-8859-1 instead of simply always using utf-8 
> which is the default encoding for XML? AFAIK *all* common browsers are 
> supporting Unicode encoded with utf-8.


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