Bookmark Topic Watch Topic
  • New Topic

xpath evaluate exception  RSS feed

 
Ramesh Y Patil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Ramesh Y Patil
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

Looks like I posted the question in the wrong forum. It should have been in XML technologies. Sorry.

Thanks
Ramesh
 
Ulf Dittmer
Rancher
Posts: 42970
73
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!