[jdom-interest] org.jdom.JDOMException

Laurent Bihanic laurent.bihanic at atosorigin.com
Wed Jul 24 01:37:11 PDT 2002


Hi,

Your XML document includes a DTD declaration and the XML parser needs to read 
the DTD file in order to resolve external entities that may be referenced by 
your document.
This DTD file is declared as located on msdn.microsoft.com so the parser 
attempted to connect to this site but you probably did not have any active 
Internet connection at that time.

You can solve this problem by downloading the DTD file to store it locally and 
use SAXBuilder's setEntityResolver() to register your implementation of 
org.xml.sax.EntityResolver. Entity resolvers, when present, are used by SAX 
parsers to resolve references to enternal entities such as DTD files. In your 
implementation you just need to test the public or system ID. If it matches 
the one defined for the DTD file, return a SAX InputSource pointing at your 
local copy.

Hope this helps,

Laurent

TAZ0789 at aol.com wrote:
> Hi all,
> 
>    I'm new to xml and jdom.  I wrote a simple program that reads a 
> simple xml file.  The java file compiles ok, but when I run it, it gives 
> me the following error, following by the java source.  Please help.  Thanks.
> 
> D:\sjsu\cs296>java WeblogsJDOM weblog.xml
> org.jdom.JDOMException: Error in building: msdn.microsoft.com
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:373)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:772)
>         at WeblogsJDOM.listChannels(WeblogsJDOM.java:25)
>         at WeblogsJDOM.main(WeblogsJDOM.java:62)
> Caused by: java.net.UnknownHostException: msdn.microsoft.com
>         at java.net.InetAddress.getAllByName0(InetAddress.java:571)
>         at java.net.InetAddress.getAllByName0(InetAddress.java:540)
>         at java.net.InetAddress.getByName(InetAddress.java:449)
>         at java.net.Socket.<init>(Socket.java:100)
>         at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:331)
>         at sun.net.www.http.HttpClient.openServer(HttpClient.java:517)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:267)
>         at sun.net.www.http.HttpClient.<init>(HttpClient.java:277)
>         at sun.net.www.http.HttpClient.New(HttpClient.java:289)
>         at 
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
> ..java:408)
>         at 
> sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
> nection.java:501)
>         at java.net.URL.openStream(URL.java:798)
>         at 
> org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultRe
> aderFactory.java:149)
>         at 
> org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExtern
> alEntity(DefaultEntityHandler.java:772)
>         at 
> org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExtern
> alSubset(DefaultEntityHandler.java:571)
>         at 
> org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScann
> er.java:1139)
>         at 
> org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDoc
> umentScanner.java:2145)
>         at 
> org.apache.xerces.framework.XMLDocumentScanner.access$0(XMLDocumentSc
> anner.java:2100)
>         at 
> org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispa
> tch(XMLDocumentScanner.java:831)
>         at 
> org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
> canner.java:381)
>         at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:772)
>         at WeblogsJDOM.listChannels(WeblogsJDOM.java:25)
>         at WeblogsJDOM.main(WeblogsJDOM.java:62)




More information about the jdom-interest mailing list