I think you are missing an input.reset() somewhere.
Thomas wrote:
Thanks Michael!
I created a directory \endorsed in my JRE folder and copied the xercesImpl.jar and xml-apis.jar into that directory.
Now I get the following error: SAXException: Premature end of file.
Any ideas?
Best regards,
Tommy
Michael Glavassevich wrote:
Hello Tommy,
I've seen this error message before. It doesn't come from Xerces but it does exist in the Crimson message properties. I'm pretty sure you're picking up a version of Crimson from the JDK. With JDK 1.4 adding a version of Xerces to your classpath doesn't override the one which came with the JDK. Have a look at the Endorsed Standards Override Mechanism [1]. It describes how you can override the parser included with the JDK.
Hope that helps.
[1] http://java.sun.com/j2se/1.4.1/docs/guide/standards/
On Thu, 8 Jan 2004, Thomas wrote:
Hello!
I have written the following small method to check if a memory xml stream is well-formed:
public void parse(ByteArrayInputStream memoryxml) { try { InputSource input = new InputSource(memoryxml); input.setEncoding("utf-8"); input.setByteStream(memoryxml);
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false);
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(input);
} catch (SAXException sex) { logger.error("SAXException: " + sex.getMessage()); } catch (IOException iox) { logger.error("IOException: " + iox.getMessage()); } catch (ParserConfigurationException pcex) { logger.error("ParserConfigException:" + pcex.getMessage()); } logger.info("FINISH!"); }
Unfortunately, it always returns SAXException: Document root element is missing. I am pretty sure the memoryxml contains valid xml data with a document root. I use JDK 1.4.1 and Eclipse 3.0M4.
It works fine when I pass a File instead of the memory stream...
Best regards,
Tommy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------- Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] 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]
