Re: Premature end of file

Sebastien Sahuc <[email protected]> Sun, 9 Jan 2005 20:05:56 -0800
Newsgroups gmane.text.xml.sax.devel
Message-ID <[email protected]>
This exception usually means that the content (XML document) is empty. =20=

Not trivial error message though.

Seb

On Jan 9, 2005, at 4:47 PM, Paul Wallace wrote:

> Hi,
> =A0=A0=A0 Why might the method:
> =A0
> =A0=A0=A0 public static Document parse(final InputStream in) throws =20=

> IOException, SAXException {
> =A0=A0=A0=A0=A0=A0=A0 final DocumentBuilderFactory dbf =3D =20
> DocumentBuilderFactory.newInstance();
> =A0=A0=A0=A0=A0=A0=A0 try {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return =
dbf.newDocumentBuilder().parse(in);
> =A0=A0=A0=A0=A0=A0=A0 } catch (ParserConfigurationException ex) {
> =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 throw new RuntimeException("Error =
initialising parser", =20
> ex);
> =A0=A0=A0=A0=A0=A0=A0 }
> =A0=A0=A0 }
> =A0
> exception:
> =A0
> org.xml.sax.SAXParseException: Premature end of file.
> =A0at =20
> =
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.ja=20=

> va:264)
> =A0at =20
> =
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Docum=20=

> entBuilderImpl.java:292)
> =A0at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
> =A0
> throw the said exception please? What does it infer? I am parsing a =20=

> Tomcat server.xml file, so I am assuming it is valid, well formed XML. =
=20
> Any thoughts please?
> =A0
> thanks and rgds
> =A0
> Paul.



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel