Re: XML parse DOM Connection time out

"Jacob Kjome" <[email protected]> Thu, 28 May 2009 08:22:22 -0500
Newsgroups gmane.text.xml.general
Message-ID <[email protected]>
Looks like it is trying to obtain the declared DTD of the XML document and 
can't access it.  You should set up an XML catalog resolver to allow for 
loading a local copy of the DTD rather than going out to the internet.

See:
http://xml.apache.org/commons/components/resolver/
http://xml.apache.org/mirrors.cgi#N1010F

Jake

On Thu, 28 May 2009 05:03:40 -0700 (PDT)
  gnix infosoft noida <[email protected]> wrote:
> 
> I created a document factory object and tried to parse an existing XML
> file....
> 
> Here is my code
> 
>File xmlFile = new File("C:/jboss-config.xml");
> DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
> DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
> Document doc = docBuilder.parse(xmlFile);
> int elementType = doc.getNodeType();
> switch(elementType)
> {
> case Node.ELEMENT_NODE:
> {
> String nodeElement = doc.getNodeName() ;
> if(nodeElement.equals("policy"))
> {
> Element policyElement = doc.createElement("policy_new");
> doc.appendChild(policyElement);
> break;
> }
> }
> }
> 
> When I run the code I get the following error......
> 
> java.net.ConnectException: Operation timed out: connect
> at java.net.PlainSocketImpl.socketConnect(Native Method)
> at java.net.PlainSocketImpl.doConnect(Unknown Source)
> at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
> at java.net.PlainSocketImpl.connect(Unknown Source)
> at java.net.Socket.<init>(Unknown Source)
> at java.net.Socket.<init>(Unknown Source)
> at sun.net.NetworkClient.doConnect(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.openServer(Unknown Source)
> at sun.net.www.http.HttpClient.<init>(Unknown Source)
> at sun.net.www.http.HttpClient.<init>(Unknown Source)
> at sun.net.www.http.HttpClient.New(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
> at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
> Source)
> at java.net.URL.openStream(Unknown Source)
> at
> weblogic.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:149)
> at
> weblogic.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEntity(DefaultEntityHandler.java:786)
> at
> weblogic.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalSubset(DefaultEntityHandler.java:583)
> at
> weblogic.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.java:1161)
> at
> weblogic.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDocumentScanner.java:2189)
> at
> weblogic.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentScanner.java:2143)
> at
> weblogic.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XMLDocumentScanner.java:856)
> at
> weblogic.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:399)
> at weblogic.apache.xerces.framework.XMLParser.parse(XMLParser.java:1147)
> at
> weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:203)
> at
> weblogic.xml.jaxp.RegistryDocumentBuilder.parse(RegistryDocumentBuilder.java:144)
> at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:161)
> 
> Please help
> 
> -- 
> View this message in context: 
>http://www.nabble.com/XML-parse-DOM-Connection-time-out-tp23760394p23760394.html
> Sent from the Apache XML - General mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
> 
>