Re: [Sax-devel] Premature end of file
Brought to you by:
dmegginson
From: Sebastien S. <ss...@in...> - 2005-01-10 04:06:06
|
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. |