<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 5.50.4611.1300" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=462195716-07032001>It
looks like the underlying parser tries to grab the external DTD even if it has
no plans for using it. The connection is likely failing because a http
proxy isn't set or something. Maybe JDOM needs to set a variable in the
underlying parser to disable resolution of external entities in certain
cases??</SPAN></FONT></DIV>
<DIV> </DIV><BR>
<P><FONT size=2>--<BR>Matthew MacKenzie<BR>VP Research & Development<BR>XML
Global Technologies, Inc. </FONT></P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> jdom-interest-admin@jdom.org
[mailto:jdom-interest-admin@jdom.org]<B>On Behalf Of </B>Alex
Colic<BR><B>Sent:</B> March 7, 2001 8:16 AM<BR><B>To:</B>
jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest] Newbie can't parse
document!<BR><BR></FONT></DIV>
<DIV><FONT size=2>Hi, I am new to using JDOM. I think I have done everything
correctly to create a SAXBuilder but I am getting an exception. I created a
FileInputStream and passing a File object, the same that I am passing to the
SAXBuilder, I can read and print the file to the screen.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>My code is as follows:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> String
directory="C:\\JBuilder4\\Projects\\pwWorkRequest\\src\\WEB-INF\\";<BR>
String file="web.xml";</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> File f=new File(directory + file);<BR>
FileInputStream fis=new FileInputStream(f);<BR> int n;<BR> while
((n=fis.available()) >0)<BR>
{<BR> byte[] b=new
byte[n];<BR> int
results=fis.read(b);<BR> if(results==-1)
break;<BR> String s=new
String(b);<BR>
System.out.print(s);<BR> }</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>This works OK.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>But this causes an exception:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2> SAXBuilder builder=new SAXBuilder(false);<BR>
Document doc=builder.build(f);</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The exception message is:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>java.sun.com: java.sun.com</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The printstack trace:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>org.jdom.JDOMException: java.sun.com:
java.sun.com</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:320)</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:373)</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)</FONT></DIV>
<DIV><FONT size=2>at test.main(test.java:52)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Root cause: java.net.UnknownHostException:
java.sun.com</FONT></DIV>
<DIV><FONT size=2>at
java.net.InetAddress.getAllByName0(InetAddress.java:571)</FONT></DIV>
<DIV><FONT size=2>at
java.net.InetAddress.getAllByName0(InetAddress.java:540)</FONT></DIV>
<DIV><FONT size=2>at
java.net.InetAddress.getByName(InetAddress.java:449)</FONT></DIV>
<DIV><FONT size=2>at
java.net.Socket.<init>(Socket.java:100)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.NetworkClient.doConnect(NetworkClient.java:50)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.http.HttpClient.openServer(HttpClient.java:331)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.http.HttpClient.openServer(HttpClient.java:517)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.http.HttpClient.<init>(HttpClient.java:267)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.http.HttpClient.<init>(HttpClient.java:277)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.http.HttpClient.New(HttpClient.java:289)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:379)</FONT></DIV>
<DIV><FONT size=2>at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:472)</FONT></DIV>
<DIV><FONT size=2>at java.net.URL.openStream(URL.java:798)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:149)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEntity(DefaultEntityHandler.java:747)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalSubset(DefaultEntityHandler.java:566)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.java:1131)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDocumentScanner.java:2177)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentScanner.java:2133)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XMLDocumentScanner.java:882)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)</FONT></DIV>
<DIV><FONT size=2>at
org.apache.xerces.framework.XMLParser.parse(XMLParser.java:861)</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:302)</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:373)</FONT></DIV>
<DIV><FONT size=2>at
org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)</FONT></DIV>
<DIV><FONT size=2>at test.main(test.java:52)</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Any help in figuring out what is going on is
appreciated.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Regards</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><BR>Alex Colic</FONT></DIV></BLOCKQUOTE></BODY></HTML>