SV: [jdom-interest] Strange behaviour of applet when accessing the DTD

Per Norrman pernorrman at telia.com
Wed Oct 8 03:31:51 PDT 2003


OK, 

1. An unsigned applet can only call back to the server
from where it was loaded, all other connections will
be refused. Instead of hard coding the URL of yor xml
file, build it up something like this:

	String host = getDocumentBase().getHost();
	URL url = new URL("http", host, "/eggink/dia.xml");

2. The parser cannot locate the relative DTD location because
you use an InputStream. Use the URL directly:

      Document    document = new SAXBuilder(true).build(url);

3. The use of localhost in DOCTYPE will not work when the
client reading the xml file is not on the same host. The client
will think that the DTD is on his/her/its machine. Change it to:

	<!DOCTYPE dialog SYSTEM  "tst.dtd" > 

Hope this helps!

/pmn





More information about the jdom-interest mailing list