Subject: Re: Tranforming XML document in tomcat...
From: Peter Flynn <pflynn@xxxxxx>
Date: Tue, 13 Jul 2004 11:01:49 +0100
|
On Tue, 2004-07-13 at 10:30, Arulraj wrote:
> Hello,
> I am tranforming XML document to someother text file
> using Xalan in Tomcat 5.0.25 server.
>
> I got the following error;
> HTTP Status 500 -
[...]
> root cause
>
> javax.xml.transform.TransformerException: Content is
> not allowed in prolog.
It sounds as if you have stray characters in the prolog to your document
instance (the bit at the top, before the root element start-tag). I find
the easiest way to trace this kind of error is to run an external
stand-alone parser/validator over the document (eg rxp, nsgmls, etc) to
check well-formedness or validity, because they will give you explicit
line numbers and error messages.
Java applications are notorious for giving you a megabyte of trace
showing where *Java* spat blood, and nothing at all about where in the
document the error was detected. Java people do themselves a great
disservice by assuming that it is their Java code that has failed,
when oftentimes it is the user's document/schema/dtd/stylesheet
that is at fault.
///Peter
|