You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alex Romayev <ro...@yahoo.com> on 2002/10/04 17:54:19 UTC

SunShine-InsertTransformer: encoding problem

Hi,

I'm trying my way around SunShine and running into 2
problems:

1) I have an existing XML file with UTF-8 encoding.  I
use InsertTransformer to add a new record.  It does so
correctly, but changes the file encoding to ISO-8859-1
and replaces all non-English text with "&#1057;"s and
alike.

2) I have namespace declarations at the root elemet of
the file.  After running it through the transformer,
the namespace declarations disappear.

Here is my sitemap:
<map:match pattern="admin/add-news">
 <map:act type="set-character-encoding">
   <map:parameter name="form-encoding" value="UTF-8"/>
           
  </map:act>      
  <map:act type="sunShine-session"/>
  <map:generate
src="resources/sunshine/admin/add-news-item.xml"/>
  <map:transform type="sunShine"/>
  <map:transform type="sunShineInsert"/>
  <map:serialize type="xml"/>        
</map:match>

And add-news-item.xml:

<?xml version="1.0" encoding="UTF-8"?>
<addnews 
 
xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">

  <sunshine:insert>
    <sunshine:file>content/news.xml</sunshine:file>
    <sunshine:path>/news</sunshine:path>
    <sunshine:fragment>
      <item id="test">
        <title>Hello1</title>
      </item>
    </sunshine:fragment>
   
<sunshine:replace>item[@id='test']</sunshine:replace>
  </sunshine:insert>
</addnews>

Any ideas on what I'm doing wrong?

Thanks,
-Alex

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: SunShine-InsertTransformer: encoding problem

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Hi Alex,

I just checked in a fix for the namespace problem - now
it works for me - could you please check - if everything
is working for you, too.

Thanks
Carsten

> -----Original Message-----
> From: Alex Romayev [mailto:romayev@yahoo.com]
> Sent: Tuesday, October 08, 2002 1:12 PM
> To: cocoon-users@xml.apache.org
> Subject: RE: SunShine-InsertTransformer: encoding problem
> 
> 
> --- Carsten Ziegeler <cz...@s-und-n.de> wrote:
> > 
> > Alex Romayev wrote:
> > > > This is currently hard coded into the
> > transformer(!)
> > > > which
> > > > means you can't do anything against it...
> > > > The InsertTransformer has been merged with the
> > > > SourceWritingTransformer
> > > > in 2.1-dev - the SourceWritingTransformer can be
> > > > configured
> > > > to what encoding should be used.
> > > 
> > > I did a quick search for "ISO-8859-1" in source
> > files
> > > and nothing related to InsertTransformer came up. 
> > Is
> > > there a workaround you could suggest until 2.1
> > comes
> > > out?  By the way, is there a rough timeline for
> > this
> > > release?
> > > 
> > It's not directly in the transformer. The
> > transformer uses
> > a component called ResourceConnector and this does
> > the
> > saving. The connector uses
> >
> org.apache.cocoon.xml.XMLUtils.defaultSerializeToXMLFormat
> > to serialize the XML and there you will find this
> > setting.
> > 
> > A rough time line for 2.1 is end of this year, I
> > guess
> > +/- 1 or 2 months...
> > 
> > > The namespaces in content/news.xml.  By the way,
> > I've
> > > raised this problem with SourceWriting transformer
> > as
> > > well and haven't seen it in the recent bug-list
> > > e-mail.  I'm just thinking that if the two got
> > merged,
> > > the problem might still be there.
> > > 
> > Can you give a complete test case for this? (Sitemap
> > snippet plus the two xml files) - If you can provide
> > this I will try to find the bug as soon as I have
> > time.
> > 
> > Carsten
> > 
> 
> Sure, here is the sitemap:
> 
> <map:match pattern="admin/add-news">
>   <map:act type="sunShine-session"/>
>   <map:generate
> src="resources/sunshine/admin/add-news-item.xml"/>
>   <map:transform type="sunShine"/>
>   <map:transform type="sunShineInsert"/>
>   <map:serialize type="xml"/>        
> </map:match>
> 
> And I've attached the two files (slightly simplified).
> 
> Cheers,
> -Alex
> 
> >
> ---------------------------------------------------------------------
> > Please check that your question  has not already
> > been answered in the
> > FAQ before posting.    
> > <http://xml.apache.org/cocoon/faq/index.html>
> > 
> > To unsubscribe, e-mail:    
> > <co...@xml.apache.org>
> > For additional commands, e-mail:  
> > <co...@xml.apache.org>
> > 
> 
> 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: SunShine-InsertTransformer: encoding problem

Posted by Alex Romayev <ro...@yahoo.com>.
--- Carsten Ziegeler <cz...@s-und-n.de> wrote:
> 
> Alex Romayev wrote:
> > > This is currently hard coded into the
> transformer(!)
> > > which
> > > means you can't do anything against it...
> > > The InsertTransformer has been merged with the
> > > SourceWritingTransformer
> > > in 2.1-dev - the SourceWritingTransformer can be
> > > configured
> > > to what encoding should be used.
> > 
> > I did a quick search for "ISO-8859-1" in source
> files
> > and nothing related to InsertTransformer came up. 
> Is
> > there a workaround you could suggest until 2.1
> comes
> > out?  By the way, is there a rough timeline for
> this
> > release?
> > 
> It's not directly in the transformer. The
> transformer uses
> a component called ResourceConnector and this does
> the
> saving. The connector uses
>
org.apache.cocoon.xml.XMLUtils.defaultSerializeToXMLFormat
> to serialize the XML and there you will find this
> setting.
> 
> A rough time line for 2.1 is end of this year, I
> guess
> +/- 1 or 2 months...
> 
> > The namespaces in content/news.xml.  By the way,
> I've
> > raised this problem with SourceWriting transformer
> as
> > well and haven't seen it in the recent bug-list
> > e-mail.  I'm just thinking that if the two got
> merged,
> > the problem might still be there.
> > 
> Can you give a complete test case for this? (Sitemap
> snippet plus the two xml files) - If you can provide
> this I will try to find the bug as soon as I have
> time.
> 
> Carsten
> 

Sure, here is the sitemap:

<map:match pattern="admin/add-news">
  <map:act type="sunShine-session"/>
  <map:generate
src="resources/sunshine/admin/add-news-item.xml"/>
  <map:transform type="sunShine"/>
  <map:transform type="sunShineInsert"/>
  <map:serialize type="xml"/>        
</map:match>

And I've attached the two files (slightly simplified).

Cheers,
-Alex

>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <co...@xml.apache.org>
> For additional commands, e-mail:  
> <co...@xml.apache.org>
> 


RE: SunShine-InsertTransformer: encoding problem

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Alex Romayev wrote:
> > This is currently hard coded into the transformer(!)
> > which
> > means you can't do anything against it...
> > The InsertTransformer has been merged with the
> > SourceWritingTransformer
> > in 2.1-dev - the SourceWritingTransformer can be
> > configured
> > to what encoding should be used.
> 
> I did a quick search for "ISO-8859-1" in source files
> and nothing related to InsertTransformer came up.  Is
> there a workaround you could suggest until 2.1 comes
> out?  By the way, is there a rough timeline for this
> release?
> 
It's not directly in the transformer. The transformer uses
a component called ResourceConnector and this does the
saving. The connector uses
org.apache.cocoon.xml.XMLUtils.defaultSerializeToXMLFormat
to serialize the XML and there you will find this setting.

A rough time line for 2.1 is end of this year, I guess
+/- 1 or 2 months...

> The namespaces in content/news.xml.  By the way, I've
> raised this problem with SourceWriting transformer as
> well and haven't seen it in the recent bug-list
> e-mail.  I'm just thinking that if the two got merged,
> the problem might still be there.
> 
Can you give a complete test case for this? (Sitemap
snippet plus the two xml files) - If you can provide
this I will try to find the bug as soon as I have
time.

Carsten

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: SunShine-InsertTransformer: encoding problem

Posted by Alex Romayev <ro...@yahoo.com>.
--- Carsten Ziegeler <cz...@s-und-n.de> wrote:
> 
> Alex Romayev wrote:
> > 
> > > > Hi,
> > > > 
> > > > I'm trying my way around SunShine and running
> into
> > > 2
> > > > problems:
> > > > 
> > > > 1) I have an existing XML file with UTF-8
> > > encoding. 
> > > > I
> > > > use InsertTransformer to add a new record.  It
> > > does
> > > > so
> > > > correctly, but changes the file encoding to
> > > > ISO-8859-1
> > > > and replaces all non-English text with "Q"s
> > > > and
> > > > alike.
> > > > 
> This is currently hard coded into the transformer(!)
> which
> means you can't do anything against it...
> The InsertTransformer has been merged with the
> SourceWritingTransformer
> in 2.1-dev - the SourceWritingTransformer can be
> configured
> to what encoding should be used.

I did a quick search for "ISO-8859-1" in source files
and nothing related to InsertTransformer came up.  Is
there a workaround you could suggest until 2.1 comes
out?  By the way, is there a rough timeline for this
release?

> 
> > > > 2) I have namespace declarations at the root
> > > elemet
> > > > of
> > > > the file.  After running it through the
> > > transformer,
> > > > the namespace declarations disappear.
> > > > 
> > > > ...
> > > > And add-news-item.xml:
> > > > 
> > > > <?xml version="1.0" encoding="UTF-8"?>
> > > > <addnews
>
xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">
> > > > 
> > > >   <sunshine:insert>
> > > >    
> > > <sunshine:file>content/news.xml</sunshine:file>
> > > >     <sunshine:path>/news</sunshine:path>
> > > >     <sunshine:fragment>
> > > >       <item id="test">
> > > >         <title>Hello1</title>
> > > >       </item>
> > > >     </sunshine:fragment>
> > > >    
> > > >
> > >
> >
>
<sunshine:replace>item[@id='test']</sunshine:replace>
> > > >   </sunshine:insert>
> > > > </addnews>
> > > > 
> > > > Any ideas on what I'm doing wrong?
> > > > 
> Which namespace information do you mean? The
> sunshine namespace
> in your add-news-item.xml or a namespace contained
> in your
> content/news.xml?

The namespaces in content/news.xml.  By the way, I've
raised this problem with SourceWriting transformer as
well and haven't seen it in the recent bug-list
e-mail.  I'm just thinking that if the two got merged,
the problem might still be there.

Similar question, would you suggest any workaround
before 2.1 release comes out?

Thanks for you help Carsten,
-Alex

> 
> Carsten
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <co...@xml.apache.org>
> For additional commands, e-mail:  
> <co...@xml.apache.org>
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


RE: SunShine-InsertTransformer: encoding problem

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Alex Romayev wrote:
> 
> > > Hi,
> > > 
> > > I'm trying my way around SunShine and running into
> > 2
> > > problems:
> > > 
> > > 1) I have an existing XML file with UTF-8
> > encoding. 
> > > I
> > > use InsertTransformer to add a new record.  It
> > does
> > > so
> > > correctly, but changes the file encoding to
> > > ISO-8859-1
> > > and replaces all non-English text with "Q"s
> > > and
> > > alike.
> > > 
This is currently hard coded into the transformer(!) which
means you can't do anything against it...
The InsertTransformer has been merged with the SourceWritingTransformer
in 2.1-dev - the SourceWritingTransformer can be configured
to what encoding should be used.

> > > 2) I have namespace declarations at the root
> > elemet
> > > of
> > > the file.  After running it through the
> > transformer,
> > > the namespace declarations disappear.
> > > 
> > > ...
> > > And add-news-item.xml:
> > > 
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <addnews xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">
> > > 
> > >   <sunshine:insert>
> > >    
> > <sunshine:file>content/news.xml</sunshine:file>
> > >     <sunshine:path>/news</sunshine:path>
> > >     <sunshine:fragment>
> > >       <item id="test">
> > >         <title>Hello1</title>
> > >       </item>
> > >     </sunshine:fragment>
> > >    
> > >
> >
> <sunshine:replace>item[@id='test']</sunshine:replace>
> > >   </sunshine:insert>
> > > </addnews>
> > > 
> > > Any ideas on what I'm doing wrong?
> > > 
Which namespace information do you mean? The sunshine namespace
in your add-news-item.xml or a namespace contained in your
content/news.xml?

Carsten

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: SunShine-InsertTransformer: encoding problem

Posted by Alex Romayev <ro...@yahoo.com>.
Sorry for the re-post, but there have been some mail
problems on Friday when I posted it and I haven't
heard from anyone since then.  I'm still struggling
with both problems, so any help would be greatly
appreciated.

Alex
--- Alex Romayev <ro...@yahoo.com> wrote:
> Sorry the "C" is supposed to read as (I'm separating
> with spaces) "& # 1 0 5 7 ;", the browser displays
> it
> as a letter "C".
>  
> --- Alex Romayev <ro...@yahoo.com> wrote:
> > Hi,
> > 
> > I'm trying my way around SunShine and running into
> 2
> > problems:
> > 
> > 1) I have an existing XML file with UTF-8
> encoding. 
> > I
> > use InsertTransformer to add a new record.  It
> does
> > so
> > correctly, but changes the file encoding to
> > ISO-8859-1
> > and replaces all non-English text with "�"s
> > and
> > alike.
> > 
> > 2) I have namespace declarations at the root
> elemet
> > of
> > the file.  After running it through the
> transformer,
> > the namespace declarations disappear.
> > 
> > Here is my sitemap:
> > <map:match pattern="admin/add-news">
> >  <map:act type="set-character-encoding">
> >    <map:parameter name="form-encoding"
> > value="UTF-8"/>
> >            
> >   </map:act>      
> >   <map:act type="sunShine-session"/>
> >   <map:generate
> > src="resources/sunshine/admin/add-news-item.xml"/>
> >   <map:transform type="sunShine"/>
> >   <map:transform type="sunShineInsert"/>
> >   <map:serialize type="xml"/>        
> > </map:match>
> > 
> > And add-news-item.xml:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <addnews 
> >  
> >
>
xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">
> > 
> >   <sunshine:insert>
> >    
> <sunshine:file>content/news.xml</sunshine:file>
> >     <sunshine:path>/news</sunshine:path>
> >     <sunshine:fragment>
> >       <item id="test">
> >         <title>Hello1</title>
> >       </item>
> >     </sunshine:fragment>
> >    
> >
>
<sunshine:replace>item[@id='test']</sunshine:replace>
> >   </sunshine:insert>
> > </addnews>
> > 
> > Any ideas on what I'm doing wrong?
> > 
> > Thanks,
> > -Alex
> > 
> >
>
---------------------------------------------------------------------
> > Please check that your question  has not already
> > been answered in the
> > FAQ before posting.    
> > <http://xml.apache.org/cocoon/faq/index.html>
> > 
> > To unsubscribe, e-mail:    
> > <co...@xml.apache.org>
> > For additional commands, e-mail:  
> > <co...@xml.apache.org>
> > 
> 
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <co...@xml.apache.org>
> For additional commands, e-mail:  
> <co...@xml.apache.org>
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: SunShine-InsertTransformer: encoding problem

Posted by Alex Romayev <ro...@yahoo.com>.
Sorry the "C" is supposed to read as (I'm separating
with spaces) "& # 1 0 5 7 ;", the browser displays it
as a letter "C".
 
--- Alex Romayev <ro...@yahoo.com> wrote:
> Hi,
> 
> I'm trying my way around SunShine and running into 2
> problems:
> 
> 1) I have an existing XML file with UTF-8 encoding. 
> I
> use InsertTransformer to add a new record.  It does
> so
> correctly, but changes the file encoding to
> ISO-8859-1
> and replaces all non-English text with "�"s
> and
> alike.
> 
> 2) I have namespace declarations at the root elemet
> of
> the file.  After running it through the transformer,
> the namespace declarations disappear.
> 
> Here is my sitemap:
> <map:match pattern="admin/add-news">
>  <map:act type="set-character-encoding">
>    <map:parameter name="form-encoding"
> value="UTF-8"/>
>            
>   </map:act>      
>   <map:act type="sunShine-session"/>
>   <map:generate
> src="resources/sunshine/admin/add-news-item.xml"/>
>   <map:transform type="sunShine"/>
>   <map:transform type="sunShineInsert"/>
>   <map:serialize type="xml"/>        
> </map:match>
> 
> And add-news-item.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <addnews 
>  
>
xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0">
> 
>   <sunshine:insert>
>     <sunshine:file>content/news.xml</sunshine:file>
>     <sunshine:path>/news</sunshine:path>
>     <sunshine:fragment>
>       <item id="test">
>         <title>Hello1</title>
>       </item>
>     </sunshine:fragment>
>    
>
<sunshine:replace>item[@id='test']</sunshine:replace>
>   </sunshine:insert>
> </addnews>
> 
> Any ideas on what I'm doing wrong?
> 
> Thanks,
> -Alex
> 
>
---------------------------------------------------------------------
> Please check that your question  has not already
> been answered in the
> FAQ before posting.    
> <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:    
> <co...@xml.apache.org>
> For additional commands, e-mail:  
> <co...@xml.apache.org>
> 


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>