aspose file tools*
The moose likes XML and Related Technologies and the fly likes getting exception please help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "getting exception please help" Watch "getting exception please help" New topic
Author

getting exception please help

Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Hi i am using JDom to parse an xml file. But i am getting exception as following:

org.jdom.JDOMException: Error in building: Connection timed out: connect
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:306)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:583)

I am developing a web site and i am using following code:

[ July 23, 2004: Message edited by: Ali Gohar ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Is the XML file you're reading referring to some URLs which cannot be accessed from your machine?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Hi,
Thanks for your reply. I am actually trying to parse the Web.xml file and it has the urls that cannot be accessed from my system. So is there any solution for this?

Thanks again.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I suppose you're talking about the URLs in the DOCTYPE declaration? If that's the case, you should be able to get rid of the exception by calling setValidating(false) on the DocumentBuilderFactory you're getting your parser from (or SAXParserFactory if you're using SAX instead of DOM).
Ali Gohar
Ranch Hand

Joined: Mar 18, 2004
Posts: 572
Hi Lasse Koskela,

Thanks very much for your replies. I have set the validation to false but it still doing that . Is there anyway to by pass that DocType?

The doctype is

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">


Regards,
Ali Gohar.
[ July 26, 2004: Message edited by: Ali Gohar ]
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
That's the only way I can think of. Then again, you could always run the document through a filtering class which removes the DOCTYPE declaration from the stream if it finds one.

I.e. instead of

do something like
 
Don't get me started about those stupid light bulbs.
 
subject: getting exception please help