tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rashmi Rubdi <dev_subscripti...@yahoo.com>
Subject Re: Change the encoding format of xml outpu
Date Sat, 20 Jan 2007 19:51:56 GMT
Sarah,

I'm just following up on what JV mentioned.

The "Content is not allowed in prolog" is caused when there is the BOM - Byte Order Mark character
before the prolog <?xml ...

The BOM characters are 3 hexadecimal characters EF BB BF, and are invisible in editors like
Notepad, Eclipse etc. 

When you are debugging your XML file you will need a Hex editor  to see if the 3 characters
are still being generated. 

The "Content is not allowed in prolog" error also occurs if your code is unable to locate
an XML or XSL file, either because it is misspelled, or not present in the directory etc.

-Rashmi

----- Original Message ----
From: JV <jv832@orange.nl>
To: Tomcat Users List <users@tomcat.apache.org>
Sent: Saturday, January 20, 2007 2:39:03 PM
Subject: Re: Change the encoding format of xml outpu


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


 
____________________________________________________________________________________
8:00? 8:25? 8:40? Find a flick in no time 
with the Yahoo! Search movie showtime shortcut.
http://tools.search.yahoo.com/shortcuts/#news

---------------------------------------------------------------------
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


Mime
View raw message