[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Problem parsing XML file with Xerces-J

  • To: xml-dev@l...
  • Subject: Problem parsing XML file with Xerces-J
  • From: Midsummer Sun <midsummer.sun@g...>
  • 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@g...>

xerces parse file
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,

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.