Hi all,
I am using the inputsource to evaluate xpaths from xml using
Java's xerces xpath utility. Following is a snippet of the code.
InputStream stream = new ByteArrayInputStream(bytes);
InputSource inputSource = new InputSource();
inputSource.setByteStream(stream);
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
String val1 = (xpath.evaluate("/message/payload[1]/segment[1]/@encode", inputSource));
For multiple iterations of the above code and when running on debug, it throws this exception. It works fine while running the code without the debug. I think this has something to do with a connecton time out for the sax inputsource.
Fatal Error] :-1:-1: Premature end of file.
org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:468)
Please help.