Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: org.xml.sax.SAXParseException: Premature end of file Date: Thu, 20 Oct 2011 14:06:36 -0700 (PDT) Organization: http://groups.google.com Lines: 57 Message-ID: <17780527.1116.1319144796758.JavaMail.geo-discussion-forums@prib32> References: <22aef44f-90f0-4fe4-a20e-64f336e4c1b3@g25g2000yqh.googlegroups.com> <824e4576-7c4e-4fa4-b7c6-58541513bd5f@f13g2000vbv.googlegroups.com> Reply-To: comp.lang.java.programmer@googlegroups.com NNTP-Posting-Host: 2620:0:1000:2404:224:d7ff:fe69:5838 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1319155251 1492 127.0.0.1 (21 Oct 2011 00:00:51 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 21 Oct 2011 00:00:51 +0000 (UTC) In-Reply-To: <824e4576-7c4e-4fa4-b7c6-58541513bd5f@f13g2000vbv.googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2620:0:1000:2404:224:d7ff:fe69:5838; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Google-Web-Client: true Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9058 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: -- Lew