File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Content is not allowed in prolog.

 
LazyCoder
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.fop.apps.Driver.render(Driver.java:424)
at org.apache.fop.apps.Driver.run(Driver.java:508)
at com.portal.PDFWriter.printDocument(PDFWriter.java:83)
at com.portal.PDFWriter.<init>(PDFWriter.java:32)
at com.portal.PDFWriter.main(PDFWriter.java:93)

can anybody suggest why we get the above
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the start of your document is not clean - perhaps an extra character or two accidently got in. You should be able to extract the line and column it is objecting to from the SAXException.
Bill
[ November 05, 2004: Message edited by: William Brogden ]
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
William is right.
Actually I faced such a problem when I had saved an xml document's specific parts from within Windows Notepad into UltraEdit (via CTRL-C CTRL-V) The 1st hexadecimal numbers are: FFFE 3C00 3F00 7800 6D00 6C00 which maps to FFFE<?xml By the way FFFE: means Unicode UTF-8 Big Endian Encoding .
Actually nothing was wrong. I donot figure out WHY but it is so.. then I chose DOS Schema and could process the files.
[ February 18, 2005: Message edited by: R�stem-� Zal� ]
 
Rashmi Gouder
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont have access to UNIX system, cant test if my xml file has those special characters before the prolog.

but heres my code

<%@ page language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<html>
<head>
<title></title></head>
<body>
<c:import url="test5.xml" var="xml" charEncoding="ISO-8859-1"/>
<x arse xml="${xml}" varDom="doc" />
</body>
</html>

this is my xml file, but I still get the error "Content is not allowed in prolog"

<?xml version="1.0" encoding="ISO-8859-1"?>
<test><value1>valuex</value1></test>

this is really frustrating, what can I do to fix this problem, when I dont have access to Unix or Linux

Is there an editor for Windows which allows me to check for the special characters which appear before the prolog?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13045
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

All of that goes into the output stream before your XML - no wonder you get that error. Your central mistake is trying to use a JSP where you should be using a servlet.
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic