Okay, to be clear, what i do is the following:

<%@ page contentType="application/xml" %><?xml version="1.0" encoding="utf-8"?>

This is the first line in my JSP page that creates XML. It's the first line, first character, no spaces inbetween the two declarations. This works for me.

Up til now I've created XML using JSTL, and then I had more problems with characters like 0A and 09, which messed up the XML. This was especially the case with SQL Server. So I removed those characters from the resultstring. I haven't had a problem with BOM-characters (didn't even know they existed)!

<c:set var="result" value="${fn:replace(searchString,char0A, '')}"/>
<c:set var="result" value="${fn:replace(searchString,char0D, '')}"/>
<c:set var="result" value="${fn:replace(searchString,char09, '')}"/>

JV


Op 20 jan 2007, om 22:18 heeft Martin Gainty het volgende geschreven:

agreeing with the previous post..I get this same error when the XML has any whitespace characters before <?xml

Martin--
---------------------------------------------------------------------- ----- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. ---------------------------------------------------------------------- ----- Le présent message électronique (y compris les pièces qui y sont annexées, le cas échéant) s'adresse au destinataire indiqué et peut contenir des renseignements de caractère privé ou confidentiel. Si vous n'êtes pas le destinataire de ce document, nous vous signalons qu'il est strictement interdit de le diffuser, de le distribuer ou de le reproduire.
----- Original Message -----
From: "Rashmi Rubdi" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Saturday, January 20, 2007 2:51 PM
Subject: Re: Change the encoding format of xml outpu


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 <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



______________________________________________________________________ ______________
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



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

Reply via email to