[jdom-interest] EntityResolver (DTD Not Found)

Jon Baer jonbaer at digitalanywhere.com
Fri Jul 20 03:43:57 PDT 2001

Brett McLaughlin wrote:

> > it but kept getting the same error/report.
> Try it out and let is know, but it should help.

No go.  In fact Im really puzzled, the javadoc @ Sun for SAX2 show this example for
an EntityResolver:

public class MyResolver implements EntityResolver {
   public InputSource resolveEntity (String publicId, String systemId)
     if (systemId.equals("http://www.myhost.com/today")) {
              // return a special input source
       MyReader reader = new MyReader();
       return new InputSource(reader);
     } else {
              // use the default behaviour
       return null;

What I dont get here is how to make this work with SAXBuilder if I can't get access
to the Reader here (or FileReader).  What is the InputSource I should return back?
Throwing back null still gives this error:

Warning: Could not load aiml/std-65percent.aiml(Error on line 2 of document file
:/C:/WINDOWS/Desktop/Alicebot/server/aiml/std-65percent.aiml: External entity not
found: "http://www.alicebot.org/dtd/aiml-1.0.dtd".)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE aiml PUBLIC "-//A.L.I.C.E. AI Foundation//Artificial Intelligence Markup
Language 1.0//EN" "http://www.alicebot.org/dtd/aiml-1.0.dtd">


SAXBuilder builder = new SAXBuilder();
builder.setEntityResolver(new NoDTDEntityResolver());

More information about the jdom-interest mailing list