On Fri, 2005-09-23 at 16:22 -0400, Lily wrote:
> Hello,
>
> I am using the <include path=""/> to import a xmlrule file into another rule
> file, but it always give me a
>
> org.apache.commons.digester .xmlrules.XmlLoadException: Error at (6, 37:
> File "rules2.xml" not found.
> java.lang.NullPointerException
>
> I have tried to use the full path to rules2.xml or relative path, but none
> of them worked.
>From a peek at the code, it looks like in the <include> tag you would
have to specify either an absolute URL (eg "file:/foo/xmlrules2.xml") or
would have to specify a URL which is relative to the *current working
directory* of the application.
This code is from o.a.c.d.xmlrules.FromXmlRuleSet:
/** Loads XMLRules from an URL */
private class URLXMLRulesLoader extends XMLRulesLoader {
private URL url;
public URLXMLRulesLoader(URL url) {
this.url = url;
}
public void loadRules() throws XmlLoadException {
try {
rulesDigester.parse(url.openStream());
} catch (Exception ex) {
throw new XmlLoadException(ex);
}
}
}
The rulesDigester object is a Digester used to process the xmlrules
file. The call to parse(url.openStream) isn't giving that digester
instance any hints about where the file it is parsing is (just an open
stream) so that digester couldn't possibly resolve any relative paths in
the xmlrules file except by using the current working directory as a
base.
Sure looks to me like a patch would be a nice idea. I don't use xmlrules
though, so probably won't write it myself.
Regards,
Simon
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]