What does that DOCTYPE mean? It says "Get the DTD from this location on the Internet:
http://... and use it to validate the document", right? So the parser will try to get the DTD from that location.
And only when you use the DOCTYPE, you get the message "Connection timed out: connect". The logical conclusion is that the parser is trying to get the DTD from the Internet, but it can't connect to that location.
So that probably means your program can't connect to the Internet. (It's also possible that it just couldn't connect to
http://www.w3.org, but that is less likely.)
If your program is running in an environment where you have to go through a proxy server to get to the Internet, then you have to tell the program where that proxy server is. Here's an article that explains that:
http://www.javaworld.com/javaworld/javatips/jw-javatip42.html That is most likely the problem, but it could be something else.