wood burning stoves 2.0*
The moose likes Testing and the fly likes [Fatal Error] :1:1: Content is not allowed in prolog. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "[Fatal Error] :1:1: Content is not allowed in prolog." Watch "[Fatal Error] :1:1: Content is not allowed in prolog." New topic

[Fatal Error] :1:1: Content is not allowed in prolog.

Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
I'm trying to compare an XML file to an XSLT generated file from that XML file, and when I run the the class as a JUnit Test, I get the following:

[Fatal Error] :1:1: Content is not allowed in prolog.

org.xml.sax.SAXParseException: Content is not allowed in prolog.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:352)
at org.custommonkey.xmlunit.XMLUnit.buildDocument(XMLUnit.java:339)
at org.custommonkey.xmlunit.XMLUnit.buildControlDocument(XMLUnit.java:283)
at org.custommonkey.xmlunit.Diff.<init>(Diff.java:116)
at org.custommonkey.xmlunit.examples.MyXMLTestCase.testXSLTransformation(MyXMLTestCase.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

Any ideas?
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30068

Do you know what was in the first couple lines of the XML file?

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Abder-Rahman Ali
Ranch Hand

Joined: May 22, 2008
Posts: 138
Jeanne Boyarsky wrote:Do you know what was in the first couple lines of the XML file?

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ballot.xsl"?>

Is that enough?
Sujatha Kalluri
Ranch Hand

Joined: Oct 09, 2002
Posts: 33
I am getting same problem as

[Fatal Error] file:tablestyle-darkblue.css:1:1: Content is not allowed in prolog.
ERROR: 'Content is not allowed in prolog.'
FATAL ERROR: 'Could not compile stylesheet'
javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet

My xslt file has first two lines as

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="tablestyle-darkblue.css" type="text/css" ?>

what could be the problem, can anybody help

I agree. Here's the link: http://aspose.com/file-tools
subject: [Fatal Error] :1:1: Content is not allowed in prolog.
Similar Threads
Unit tetsing (Junit) Spring Framework
Junit error
Source not found
Junit error
NULL Pointer Exception