<!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><SPAN class=951240218-07032001><FONT face=Arial color=#0000ff size=2>the
xerces parser seems to have features (docs/html/features.html in the dist) that
allow you to turn on/off such things as "load-dtd-grammar", but how you pass
through from jdom i don't know.</FONT></SPAN></DIV>
<DIV><SPAN class=951240218-07032001></SPAN> </DIV>
<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>GB/DEV - Philip
Nelson<BR><B>Sent:</B> Wednesday, March 07, 2001 5:34 PM<BR><B>To:</B>
'Matthew MacKenzie'; Alex Colic<BR><B>Cc:</B> JDOM Interest<BR><B>Subject:</B>
RE: [jdom-interest] Newbie can't parse document!<BR><BR></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=099203617-07032001>You
really can't bypass the external dtd because it may contain entities without
which the document cannot be rendered correctly. For example in a web
style dtd, &nbsp; may be defined somewhere else.</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Matthew MacKenzie
[mailto:matt@xmlglobal.com]<BR><B>Sent:</B> Wednesday, March 07, 2001 11:23
AM<BR><B>To:</B> Alex Colic<BR><B>Cc:</B> JDOM Interest<BR><B>Subject:</B>
RE: [jdom-interest] Newbie can't parse document!<BR><BR></DIV></FONT>
<DIV><SPAN class=888062017-07032001><FONT face=Arial color=#0000ff
size=2>Alex,</FONT></SPAN></DIV>
<DIV><SPAN class=888062017-07032001><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=888062017-07032001><FONT face=Arial color=#0000ff
size=2>Well, the reality is that many customers have proxy servers...so it
probably makes sense to use a properties file containing this and other info
that you can set in your constructor. I know that its a pain in the
butt just for this reason though.</FONT></SPAN></DIV>
<DIV><SPAN class=888062017-07032001><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=888062017-07032001><FONT face=Arial color=#0000ff
size=2>What parser are you using, and can anyone else suggest a way to make
this parser not resolve external entities? The only time I ever
disabled the resolution of external entities was in Perl
(XML::Parser/expat).</FONT></SPAN></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> Alex Colic
[mailto:alex.colic@pop-ware.com]<BR><B>Sent:</B> March 7, 2001 9:15
AM<BR><B>To:</B> Matthew MacKenzie<BR><B>Subject:</B> Re: [jdom-interest]
Newbie can't parse document!<BR><BR></FONT></DIV>
<DIV><FONT size=2>Well, well, that was the solution.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>But, I was hopping that builder(false) or
builder.setValidation(false) would bypass the dtd. </FONT></DIV>
<DIV><FONT size=2>I can't distribute a class to customers if I have to
worry about setting up the properties for a proxyserver and
host.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Is there a way to get around this?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Alex</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=matt@xmlglobal.com href="mailto:matt@xmlglobal.com">Matthew
MacKenzie</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=alex.colic@pop-ware.com href="mailto:alex.colic@pop-ware.com">Alex
Colic</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, March 07, 2001
12:03 PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [jdom-interest] Newbie
can't parse document!</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=365475916-07032001><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=365475916-07032001><FONT face=Arial color=#0000ff
size=2>Okay, do you have a HTTP proxy? If so, try doing this at
the start of your class:</FONT></SPAN></DIV>
<DIV><SPAN class=365475916-07032001><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=365475916-07032001><PRE>Properties props = System.getProperties();
props.put("http.proxyHost", "my.proxyhost.com");
props.put("http.proxyPort", "8080");</PRE><PRE> </PRE><PRE>(make sure you customize the values).
</SPAN><FONT size=2></FONT></PRE><PRE><FONT size=2>--<BR>Matthew MacKenzie<BR>VP Research & Development<BR>XML Global Technologies, Inc. </FONT></PRE></DIV>
<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> Alex Colic
[mailto:alex.colic@pop-ware.com]<BR><B>Sent:</B> March 7, 2001 9:04
AM<BR><B>To:</B> Matthew MacKenzie<BR><B>Subject:</B> Re:
[jdom-interest] Newbie can't parse document!<BR><BR></FONT></DIV>
<DIV><FONT size=2>Hi,</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>you are right. I took the:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><!DOCTYPE web-app<BR> PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"<BR> "<A
href="http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">http://java.sun.com/j2ee/dtds/web-app_2.2.dtd</A>"></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>out of the web.xml file and it parsed
correctly.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>This works but this does not seem correct. Is this a
bug in the parser?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Alex</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=matt@xmlglobal.com href="mailto:matt@xmlglobal.com">Matthew
MacKenzie</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=alex.colic@pop-ware.com
href="mailto:alex.colic@pop-ware.com">Alex Colic</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, March 07, 2001
11:55 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [jdom-interest]
Newbie can't parse document!</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=890425316-07032001><FONT face=Arial color=#0000ff
size=2>I am not sure if that is the problem, because I was able to
connect to the URL below. Why not try commenting out the DTD
reference and see is the problem persists before blaming validation
:-) I don't know what else would be trying to connect, unless
you are connecting somewhere in your file. It is possible that
the underlying parser is trying to grab the DTD unsuccessfully
because of your proxy server.</FONT></SPAN></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> Alex
Colic [mailto:alex.colic@pop-ware.com]<BR><B>Sent:</B> March 7,
2001 8:50 AM<BR><B>To:</B> Matthew MacKenzie<BR><B>Subject:</B>
Re: [jdom-interest] Newbie can't parse
document!<BR><BR></FONT></DIV>
<DIV><FONT size=2>Hi, thanks for the reply.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The file I am using is the standard web.xml file
used by Tomcat. It does have a DTD:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2><!DOCTYPE web-app<BR>
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
2.2//EN"<BR> "<A
href="http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">http://java.sun.com/j2ee/dtds/web-app_2.2.dtd</A>"></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I thought if I created the builder with the
(false) constructor it would bypass the above. Is my thinking
incorrect?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I tried to ping java.sun.com but that failed do
to our use of a proxy server. </FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Is the above my problem?</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Alex</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2></FONT> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message -----
</DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=matt@xmlglobal.com
href="mailto:matt@xmlglobal.com">Matthew MacKenzie</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=alex.colic@pop-ware.com
href="mailto:alex.colic@pop-ware.com">Alex Colic</A> ; <A
title=jdom-interest@jdom.org
href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, March 07,
2001 11:39 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE:
[jdom-interest] Newbie can't parse document!</DIV>
<DIV><BR></DIV>
<DIV><SPAN class=906143816-07032001><FONT face=Arial
color=#0000ff size=2>Does the XML file in question contain a
reference to a DTD or Schema that is located on a server that
does not resolve to an IP (aka does not
exist)??</FONT></SPAN></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>
<A
href="mailto:jdom-interest-admin@jdom.org">jdom-interest-admin@jdom.org</A>
[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> <A
href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A><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></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>