You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sarah Parrott <pa...@googlemail.com> on 2007/01/20 20:19:38 UTC

Change the encoding format of xml outpu

Hi,

 I'm using Tomcat 5.5 from within eclipse, and using java code to create and
save a new xml document on the server. The first line in the xml doc is

<?xml version="1.0" encoding="UTF-16"?>

If I try and view this in eclipse, or parse it using a sax parser, I get the
error 'content not allowed in prolog'. However, I can open it fine in
something like notepad, and if I change the encoding in the file to UTF-8,
it opens fine in eclipse/SAX with no other modifications to the file. How
can I change it so it is written with UTF-8 in the first place? I've tried
looking in the server properties but every reference to encoding I can find
is already set to UTF-8. Is there something I'm missing? Or am I going to
have to do an xslt transformation each time read the xml?

Thanks in advance,
Sarah

Re: Change the encoding format of xml outpu

Posted by JV <jv...@orange.nl>.
Hi Sarah,

Have you included this in the page-code?

<%@ page contentType="application/xml" %>

JV

Op 20 jan 2007, om 20:19 heeft Sarah Parrott het volgende geschreven:

> Hi,
>
> I'm using Tomcat 5.5 from within eclipse, and using java code to  
> create and
> save a new xml document on the server. The first line in the xml  
> doc is
>
> <?xml version="1.0" encoding="UTF-16"?>
>
> If I try and view this in eclipse, or parse it using a sax parser,  
> I get the
> error 'content not allowed in prolog'. However, I can open it fine in
> something like notepad, and if I change the encoding in the file to  
> UTF-8,
> it opens fine in eclipse/SAX with no other modifications to the  
> file. How
> can I change it so it is written with UTF-8 in the first place?  
> I've tried
> looking in the server properties but every reference to encoding I  
> can find
> is already set to UTF-8. Is there something I'm missing? Or am I  
> going to
> have to do an xslt transformation each time read the xml?
>
> Thanks in advance,
> Sarah


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org