Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9058

Re: org.xml.sax.SAXParseException: Premature end of file

From Lew <lewbloch@gmail.com>
Newsgroups comp.lang.java.programmer
Subject Re: org.xml.sax.SAXParseException: Premature end of file
Date 2011-10-20 14:06 -0700
Organization http://groups.google.com
Message-ID <17780527.1116.1319144796758.JavaMail.geo-discussion-forums@prib32> (permalink)
References <22aef44f-90f0-4fe4-a20e-64f336e4c1b3@g25g2000yqh.googlegroups.com> <j7pka5$bqr$1@dont-email.me> <824e4576-7c4e-4fa4-b7c6-58541513bd5f@f13g2000vbv.googlegroups.com>

Show all headers | View raw


DO NOT POST CODE USING TAB AS AN INDENTATION CHARACTER!

Bad!

laredotornado wrote:
> You mean a syntax error in the Java?  Ok, here it is ...
> 
> 	public static com.myco.clearing.commons.xml.Node parse(String xml)
> throws
> 			ParserConfigurationException, SAXException, IOException {
> 		xml = xml.trim();
> 		return parse(new ByteArrayInputStream(xml.getBytes()));

Encoding?

> 	}
> 
> 	/**
> 	 *
> 	 * @param xml

Where is 'xml'?

> 	 * @return Parsed xml

What is the definition of 'Parsed'?

> 	 * @throws XMLParseException

No, it doesn't.

> 	 * @throws ParserConfigurationException
> 	 * @throws IOException
> 	 * @throws SAXException
> 	 */
> 	public static com.myco.clearing.commons.xml.Node parse(final
> InputStream xmlInputStream)
> 			throws ParserConfigurationException,
> 			SAXException, IOException {
> 
> 		final DocumentBuilderFactory dbf =
> DocumentBuilderFactory.newInstance();
> 		final DocumentBuilder db = dbf.newDocumentBuilder();
> 		final Document doc = db.parse(xmlInputStream);
> 		doc.getDocumentElement().normalize();
> 
> If you mean the XML, what is the XML syntax error or what tool can I
> use to see it? 

Is there a newline at the end of your XML?

GIYF:
<http://www.w3schools.com/xml/xml_validator.asp>

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

org.xml.sax.SAXParseException: Premature end of file laredotornado <laredotornado@zipmail.com> - 2011-10-20 08:41 -0700
  Re: org.xml.sax.SAXParseException: Premature end of file markspace <-@.> - 2011-10-20 10:04 -0700
    Re: org.xml.sax.SAXParseException: Premature end of file laredotornado <laredotornado@zipmail.com> - 2011-10-20 10:59 -0700
      Re: org.xml.sax.SAXParseException: Premature end of file Lew <lewbloch@gmail.com> - 2011-10-20 14:06 -0700
  Re: org.xml.sax.SAXParseException: Premature end of file Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2011-10-20 20:15 +0200

csiph-web