[jdom-interest] EntityResolver (DTD Not Found)
Szegedi, Attila
szegedi at scriptum.hu
Fri Jul 20 04:10:05 PDT 2001
Right. The solution suggested originally is wrong. When an EntityResolver
returns null from resolveEntity, it means "I have no clue about this entity,
you (the parser) try looking it up however you can" -- which usually means
the parser will try interpreting the system id as an URL or a file, then
give up. If you really want to provide an empty entity, you could try
returning
new InputSource(new StringReader(""))
instead of null.
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Jon Baer
> Sent: Friday, July 20, 2001 12:44 PM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] EntityResolver (DTD Not Found)
>
>
> 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".)
>
> From:
>
> <?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">
>
> Using:
>
> SAXBuilder builder = new SAXBuilder();
> builder.setValidation(false);
> builder.setEntityResolver(new NoDTDEntityResolver());
>
>
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com
More information about the jdom-interest
mailing list