File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes premature end of file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "premature end of file " Watch "premature end of file " New topic

premature end of file

vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
I have an xml file called AR1048615.xml. I am trying to transform it using saxon. But during the transformation, it fails and gives me the following error:
Fatal error reported by XML parser: premature end of file (found "[EOF]")
URL: file:/work/vsubra/edi/saxon/AR1048615.xml
Line: 123
Column: 0
premature end of file (found "[EOF]"): premature end of file (found "[EOF]")
Transformation failed
Error(s) in transforming the file AR1048615.xml
Line 123 is nothing but the last line /cxml
where the file is closed.
I dont see anything wrong in the xmlfile. How can I fix this
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Try to open your xml file in IE5.5 or up to see what it tells you.
vidhya subramaniam
Ranch Hand

Joined: Jul 14, 2001
Posts: 91
When i open the file in IE5.5 or higher , it doesnt give me any error. I tried to open it with a text editor and compare it with files that were working fine without any error , i found that there were some extra spaces between feww lines (may be 1 enter). is that the problem, because when i rmoved those extra spaces and save it it works fine. So how can i fix this error? ( kind of some script or something)
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
some extra spaces between feww lines (may be 1 enter). is that the problem,
I would highly suspect that there is a "carriage return" at line 123. I did see problems like this earlier. But unfortunately, in my application it is completely random (or so I think) and I can't reproduce it consistently to debug.
I would love to hear a fix for such things.
I tried using the "strip-space" thingy but it din't take me too long.
- madhav

Take a Minute, Donate an Hour, Change a Life
Rajan Kumar

Joined: Jun 03, 2002
Posts: 11
Even I have the same problem, couldn't fix. Any suggestions please?
PS: I removed all the empty spaces, carriage returns from the file. Still the SAX parser gives me the same error.
I agree. Here's the link:
subject: premature end of file
Similar Threads
EOF error
Struts config works on windows, not on Unix
EclEmma Installation Problem in Eclipse
Premature EOF while reading from Inputstream
==> saxonb : but : RuntimeException: No query engine found