<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=887302816-07032001>All
File objects in Java should use the / as the path
separator...</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001>i.e.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001> String directory =
"C:/JBuilder4/Projects/pwWorkRequest/src/WEB-INF/"</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=887302816-07032001>G.</SPAN></FONT></DIV>
<BLOCKQUOTE style="MARGIN-RIGHT: 0px">
<DIV align=left class=OutlookMessageHeader dir=ltr><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> Wednesday, March 07, 2001 4:16 PM<BR><B>To:</B>
jdom-interest@jdom.org<BR><B>Subject:</B> [jdom-interest] Newbie can't parse
document!<BR><BR></DIV></FONT>
<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>