Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Premature End Of File - SaxParseException

843834Jul 4 2005 — edited Aug 13 2010
Hello everyone,

everytime i try to access an XML File i get the following error output:

[Fatal Error] :-1:-1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.

The XML file looks like this:

<?xml version="1.0" encoding="UTF-8"?><Rezept><Name>test<Kochbuch>test</Kochbuch><Seite>23</Seite><Zutaten><Zutat Menge="2">eier</Zutat></Zutaten><Anleitung>Geben Sie hier das Rezept ein</Anleitung></Name></Rezept>

Well, it's German but maybe you could tell me whats wrong with that. The code that tries to access the XML file is the following:
try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = factory.newDocumentBuilder();
                doc = builder.parse(file);
            } catch (ParserConfigurationException e) {
                new ExceptionFrame(e.toString());
            } catch(SAXException ex) {
                ex.printStackTrace();
            } catch(IOException ex) {
                ex.printStackTrace();
            }
This is only called - and it only happens - when the file exists.
So, like usual, i am very happy for any advice that lead me to the right direction and to make me see the light :-)

Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 10 2010
Added on Jul 4 2005
18 comments
98,183 views