• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML XSL problem in tomcat

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I needed help with the following:
I have written a class that taken an xml file and xsl and generates a HTML file as a result.When i run the code on jdk it works fine but when i transfer it to tomcat as a web application and call it from a jsp.It gives me the following error:


; Line#: 1; Column#: 1
javax.xml.transform.TransformerException: Content is not allowed in prolog.
at org.apache.xalan.transformer.TransformerImpl.fatalError(TransformerIm
pl.java:744)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:720)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1192)
at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
l.java:1170)
at com.associa.bacs.xml.RepGen.buildReport(RepGen.java:94)
at BACSImport._0002fBACSImport_0002ffileviewer_0002ejspfileviewer_jsp_6.
_jspService(_0002fBACSImport_0002ffileviewer_0002ejspfileviewer_jsp_6.java:78)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspSer
vlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspSer
vlet.java:282)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
29)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:4
05)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:812)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758
)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
:501)
at java.lang.Thread.run(Thread.java:479)





I am using tomcat 3.2.3 and jdk1.3.1_09.I have to use these two cause the system was developed previously by other people who have written code tht works only on tht version of tomcat.
Also i googled alot for the above error and got alot of solutions but none of them seem to work.There are no non whitespace characters in my xml or xsl prolog.The following is the xml file

<?xml version="1.0" encoding="ISO-8859-1"?>
<BACSDocument>
<Data>
<MessagingAdvices>
<MessagingHeader

[ML - snip ]


<SignatureMethod></SignatureMethod>
<Signature></Signature>
</BACSDocument>

Both the xml and xsl use same encoding that is iso-8859-1.I also tried using different versions of xalan.jar and other .jars required for xml but to no avail.
Please could someone help me with this.

Thanks

Edit Comment:
This message was edited to remove some XML information.

- ML
[ May 25, 2005: Message edited by: Madhav Lakkapragada ]
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nothing really jumps out at me. But try transforming with other tools like a standalone Xalan-Java or using Felix (don't have the link handy). Maybe they can report a better error.

For some reason I can't explain, I am tempted to say - remove the encoding attribute and give it a shot.

- m............assuming that the XML/XSL is well-formed!
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just for fun - try inserting a space after encoding="ISO-8859-1" so it reads

I vaguely recall some problem like that.
Bill
 
shawn kennedy
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Well i have tried removeing the encoding bits as well as using an XML editor to check its wellformed,validity and the editor also generated the html file using the xml and xsl.So theres no problem on that front.
Does anyone have any other ideas.
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be a problem that your tomcat uses a older xml parser than your local jdk ??
Just guessing!!
 
shawn kennedy
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey guys,
Thanks for your help.Ive resolved the problem.It was actually my mistake while testing the java class under jdk i had actually read the xml file into a string reader and used that in the streamsource while using the transform() and that was in the main method.While calling the java class theu the jsp i forgot to perform that step and instead of passing the xml data i was passsing the name of the xml file.Hence it was reading the entire file path instead of xml data so the "Content not allowed in prolog" error.
 
reply
    Bookmark Topic Watch Topic
  • New Topic