Premature end of file
"Paul Wallace" <[email protected]> Mon, 10 Jan 2005 11:47:06 +1100
| Newsgroups | gmane.text.xml.sax.devel |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format.
------_=_NextPart_001_01C4F6AE.4BBC5956
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Hi,
Why might the method:
=20
public static Document parse(final InputStream in) throws
IOException, SAXException {
final DocumentBuilderFactory dbf =3D
DocumentBuilderFactory.newInstance();
try {
return dbf.newDocumentBuilder().parse(in);
} catch (ParserConfigurationException ex) {
throw new RuntimeException("Error initialising parser", ex);
}
}
=20
exception:
=20
org.xml.sax.SAXParseException: Premature end of file.
at
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.jav
a:264)
at
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Docume
ntBuilderImpl.java:292)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
=20
throw the said exception please? What does it infer? I am parsing a
Tomcat server.xml file, so I am assuming it is valid, well formed XML.
Any thoughts please?
=20
thanks and rgds
=20
Paul.
------_=_NextPart_001_01C4F6AE.4BBC5956
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2800.1479" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D218524000-10012005>Hi,</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D218524000-10012005> =20
Why might the method:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D218524000-10012005></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN =
class=3D218524000-10012005> =20
public static Document parse(final InputStream in) throws IOException,=20
SAXException {<BR> final=20
DocumentBuilderFactory dbf =3D=20
DocumentBuilderFactory.newInstance();<BR> &n=
bsp; =20
try =
{<BR> =20
return=20
dbf.newDocumentBuilder().parse(in);<BR> &nbs=
p; =20
} catch (ParserConfigurationException ex)=20
{<BR> =
throw=20
new RuntimeException("Error initialising parser",=20
ex);<BR> =
}<BR> =20
}</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D218524000-10012005></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D218524000-10012005>exception:</SPAN></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><SPAN=20
class=3D218524000-10012005></SPAN></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>org.xml.sax.SAXParseException: =
Premature end of=20
file.<BR> at=20
com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java=
:264)<BR> at=20
com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Documen=
tBuilderImpl.java:292)<BR> at=20
javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)</FONT></=
DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><SPAN class=3D218524000-10012005><FONT face=3DArial size=3D2>throw =
the said=20
exception please? What does it infer? I am parsing a Tomcat server.xml =
file, so=20
I am assuming it is valid, well formed XML. Any thoughts=20
please?</FONT></SPAN></DIV>
<DIV><SPAN class=3D218524000-10012005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D218524000-10012005><FONT face=3DArial size=3D2>thanks =
and=20
rgds</FONT></SPAN></DIV>
<DIV><SPAN class=3D218524000-10012005><FONT face=3DArial=20
size=3D2></FONT></SPAN> </DIV>
<DIV><SPAN class=3D218524000-10012005><FONT face=3DArial=20
size=3D2>Paul.</FONT></SPAN></DIV></BODY></HTML>
------_=_NextPart_001_01C4F6AE.4BBC5956--
-------------------------------------------------------
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