Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 18th, 2008, 11:43 PM
Authorized User
 
Join Date: Oct 2006
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default org.xml.sax.SAXParseException: Premature end

I am getting the following exception when i tried to parse the XML

The code snippet which parses the xml is

org.jdom.Document jdomDoc=null;
DOMBuilder builder = new DOMBuilder();
try {
BufferedWriter out = new BufferedWriter(new FileWriter appAdvFilePath));
out.write(appAdvTXML);
out.close();
File newFile = new File(appAdvFilePath);
jdomDoc = builder.build(newFile); // Line Creating issue

org.xml.sax.SAXParseException: Premature end of file.
    at org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(Unknown Source) at org.apache.xerces.util.ErrorHandlerWrapper.fatalEr ror(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
    at org.apache.xerces.impl.XMLVersionDetector.determin eDocVersion(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse (Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(U nknown Source)
    at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:64)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:615)
    at org.jdom.adapters.JAXPDOMAdapter.getDocument(JAXPD OMAdapter.java:140)
    at org.jdom.input.DOMBuilder.build(DOMBuilder.java:22 2)
    at org.jdom.input.DOMBuilder.build(DOMBuilder.java:28 7)
    at com.manh.baseservices.edi.applicationadvice.Applic ationAdviceCommon.postToRouter(ApplicationAdviceCo mmon.java:112)


 
Old March 19th, 2008, 04:01 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I would imagine that the error message means exactly what it says: the end of file was encountered when the document was still incomplete. For example I would expect such a message if the input is

<start>content</st

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Oracle back-end MS-Access 2003 client front-end Corey Access 2 February 16th, 2007 08:31 AM
How to parse xml using SAX Parser?? priyatowin XSLT 2 September 8th, 2006 02:56 AM
package org.xml does not exist?? CFerthorney J2EE 1 May 10th, 2004 05:26 PM
import org.xml.sax is deprecated sax XML 1 November 17th, 2003 08:35 AM
java.lang.NoClassDefFoundError: org/xml/sax/XMLRea kcheung XSLT 0 August 8th, 2003 08:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.