OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Problem parsing XML file with Xerces-J

[ Lists Home | Date Index | Thread Index ]
  • To: xml-dev@lists.xml.org
  • Subject: Problem parsing XML file with Xerces-J
  • From: Midsummer Sun <midsummer.sun@gmail.com>
  • Date: Thu, 31 Mar 2005 15:02:40 +0530
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=tClpLMVgELfBk5dXZlTE5HbEEp3XcdY0xg6yDAoEirCmuXqoGKi5tisN/w3DKL4LcFTaxy+yXam0XaEItzA9vJfk6iGI4qFuvQtjXbb5wvfwIv0/8xPE9WACvUdhSnqkdKuk2YlGmZdmBDXP+thBcqj1JP8tbmfWGUzND78ypUE=
  • Reply-to: Midsummer Sun <midsummer.sun@gmail.com>

Hi Friends,
   I am parsing a XML file using Xerces-J 2.6.2 using the DOM API. I
am facing some problem. The XML document is available in my program in
Java string form.

Here is relevant portion of code (with line numbers for readibility) ..

1) DocumentBuilderFactoryImpl factory = new DocumentBuilderFactoryImpl();
2) DocumentBuilder builder = factory.newDocumentBuilder();
3) String rsp = "xmlstring";
4) Document document = builder.parse(new InputSource(new StringReader(rsp)));

A sample xmlstring is (for line 3) -
<?xml version='1.0' encoding='ISO-8859-1'?><!DOCTYPE MESSAGING SYSTEM
'http://host/x.dtd'><MESSAGING></MESSAGING>

(I am not using the validating mode. This XML is sent to my program by
a remote process and DTD reference is redundant to me).

Line 4 is giving error (I am pasting full stack trace for your reference) -
java.net.ConnectException: Connection 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.connect(Unknown Source)
        at java.net.Socket.connect(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.http.HttpClient.New(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
ce)
        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
        at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown So
urce)
        at org.apache.xerces.impl.XMLEntityManager.startEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.startDTDEntity(Unknown Source
)
        at org.apache.xerces.impl.XMLDTDScannerImpl.setInputSource(Unknown Sourc
e)
        at org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(
Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
known Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at XYZ.main(XYZ.java:47)

I don't know what this call has to do with java.net package !

I'll appreciate help in understanding what is going wrong, and how to solve it..

Best regards,




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS