[jdom-interest] DTD-System ID read in even in non-validation mode?

Niko Schmuck niko at nava.de
Sun Feb 4 11:22:35 PST 2001


hi JDOM-users,
 
i want to use the same XML document instance in an online and an offline
environment with the help of JDOM (which is really great to use). The problem
is, if there is no network connection the System Identifier specified in the
doctype declaration cannot be resolved - even if i set validation off.
I thought this should be running because in no-validation parsing there is
no need for accessing the DTD. Please can someone tell me if i am wrong with
this assumption and what would be a solution?
 
Thanks in advance,
Niko
 
 
----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----
The java code fragment which starts the JDOM processing:
--
 
    // Specify which SAX Parser to use
    saxDriverClass = "org.apache.xerces.parsers.SAXParser";
 
    // document reading without validation
    SAXBuilder builder = new SAXBuilder(saxDriverClass, false);
 
    // Build the JDOM from Document
    Document doc = builder.build(new File(filename));
 
----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----
A sample XML document instance with doctype declaration:
--
 
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN"
              "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
  <!-- channel definition etc. -->
</rss>
 
----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----
The java error stack trace when running the program:                          
--
 
java.net.UnknownHostException: my.netscape.com
        at java.net.InetAddress.getAllByName0(InetAddress.java:573)
        at java.net.InetAddress.getAllByName0(InetAddress.java:542)
        at java.net.InetAddress.getByName(InetAddress.java:451)
        at java.net.Socket.<init>(Socket.java:94)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:50)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:316)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:427)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:256)
        at sun.net.www.http.HttpClient.<init>(HttpClient.java:266)
        at sun.net.www.http.HttpClient.New(HttpClient.java:278)
        at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:368)
        at 
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:453)
        at java.net.URL.openStream(URL.java:814)
        at 
org.apache.xerces.readers.DefaultReaderFactory.createReader(DefaultReaderFactory.java:149)
        at 
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalEntity(DefaultEntityHandler.java:767)
        at 
org.apache.xerces.readers.DefaultEntityHandler.startReadingFromExternalSubset(DefaultEntityHandler.java:566)
        at 
org.apache.xerces.framework.XMLDTDScanner.scanDoctypeDecl(XMLDTDScanner.java:1131)
        at 
org.apache.xerces.framework.XMLDocumentScanner.scanDoctypeDecl(XMLDocumentScanner.java:2177)
        at 
org.apache.xerces.framework.XMLDocumentScanner.access$000(XMLDocumentScanner.java:86)
        at 
org.apache.xerces.framework.XMLDocumentScanner$PrologDispatcher.dispatch(XMLDocumentScanner.java:882)
        at 
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:380)
        at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:386)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:455)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:436)
        at nava.news.RSS.RSSFactory.read(RSSFactory.java:84)
 
----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----%<----
                                                                              
                                                          



More information about the jdom-interest mailing list