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(DocumentBuilderImpl.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]
