Problem occurs when parsing uri into dom.
Hey guys, I got problem when I tries to parse a rss feed url to dom.
It works fine with most xml urls. However, e.g, "http://digg.com/rss/index.xml" doesnt work at all. It gives java.net.SocketException (connection reset). So I reckson it even could not open the connection to that url.
Not sure about how it works and if its a rss feed server's issue.
Some code as below:
Document document = null;
DocumentBuilderFactory factory =DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
document = builder.parse(uri);
} catch (SAXException sxe) {.................} catch...............
.........................
thank you for any help in advance.
Cheers,
Lin
[790 byte] By [
lindda] at [2007-11-27 5:50:59]

# 1
This problem has nothing to do with parsing. I used a URLConnection object to get access to the input stream provided by the URL "http://digg.com/rss/index.xml". After hanging for 378 seconds I got the following error when the getInputStream() method was invoked on the URLConnection object:
java.net.SocketException: Unexpected end of file from server
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:684)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:682)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:939)
...
The error message reveals that the error occurs after the http connection has been opened. The problem is that the input stream is not appropriate even for interpreting as a file content, let alone parsing it as an XML document. Nowhere have I found a clear-cut answer to this problem which makes me think this error might be caused by a bug. You should try posting here:
http://forum.java.sun.com/forum.jspa?forumID=536