aspose file tools*
The moose likes XML and Related Technologies and the fly likes I have problem when I parsing inputstream from http Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "I have problem when I parsing inputstream from http" Watch "I have problem when I parsing inputstream from http" New topic
Author

I have problem when I parsing inputstream from http

Auttapol Pipatpatama
Greenhorn

Joined: May 31, 2004
Posts: 11
Solution
Servlet ===================================================
InputStream xmlStream = req.getInputStream();
APIRCRInterface apicrInterface = new APIRCRInterface();
String xmlRet = apicrInterface.process(xmlStream);

Java App (Use DOM4J)=======================================
in class APIRCRInterface
String xmlIn = getStreamStr(ips);
Document doc = DocumentHelper.parseText(xmlIn);

Method getStreamStr use transform inputstream to string.
When I call DocumentHelper.parseText(xmlIn); I get error
org.dom4j.DocumentException: Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.

I print xmlIn "<?xml version="1.0" encoding="UTF-8"?><request id="0000000001" command="RECONNECT"><msisdn>865634408</msisdn></request>"

How I resolve this problem?


Auttapol Pipatpatama<br />SCJP 1.4, SCWCD 1.4, <br />SCBCD Preparing
Auttapol Pipatpatama
Greenhorn

Joined: May 31, 2004
Posts: 11
When I test inside app it fine but when I call by request it's not work.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I have problem when I parsing inputstream from http