Thanks for the tip. It turns out that the problem happened due to incorrect external schema locations, which in turn led to a failure to resolve entities and subsequently to Premature end of file error message. I suppose it would be helpful if the error message indicated better the root of the problem.
Apologies for false alarm, Alex > -----Original Message----- > From: Swanson, Brion [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 25, 2002 12:30 PM > To: '[EMAIL PROTECTED]' > Subject: RE: Premature end of file > > > Hi Alex, > > I'm not sure if this will help, but try adding a newline character at the > end of your serialized string input. It's worth a shot. At > worst, it will > still complain. > > Cheers! > Brion > > -----Original Message----- > From: Aleksandar Milanovic [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 25, 2002 3:22 PM > To: Xerces-J-User > Subject: Premature end of file > > > Hi All, > > Xerces 2.1.0 keeps complaining about the premature end of file when > seemingly there is nothing wrong with the XML being parsed. This is what > happens: > > An XML document fragment is serialized to a string, and then > parsed using a > subclass of DocumentBuilderFactoryImpl called > ValidatorDocumentBuilderFactory, which in turn instantiates > ValidatorDocumentBuilders. This combination works fine with XML documents > that are received via HTTP. The problem arises when we perform > validation of > some XML data in memory. As mentioned, we serialize the XML data to a > string, and then try to parse it using the ValidatorDocumentBuilder. The > following exception is thrown: > > org.xml.sax.SAXParseException: Premature end of file. > at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:267) > at > org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderIm > pl.java:20 > 1) > at > mypackage.ValidatorDocumentBuilder.parse(ValidatorDocumentBuilder.java:92) > > At first, we thought that the XML was not being serialized properly, but > when we redirected the serialization to a file, we couldn't find anything > wrong with it. It was a well-formed and valid XML document. > Since the problem happens deep in the DOMParser, I don't think it > is related > to our subclasses. Could there be something wrong with the > encoding? We set > it explicitly to UTF-8, but it didn't help. > > thx > Alex > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
