To be precise my question would be what is the alternate method for Digester.createLoader(url) in new Digester3?
commons-digester:1.8.1 code
URL url;
ClassLoader curClassLoader = this.getClass().getClassLoader();
url = curClassLoader.getResource("filepath");
if (url != null) {
Digester tempDigester = DigesterLoader.createDigester(url);
----
----
}
Now I have upgraded commons-digester-1.8.1 to org.apcahe.commons.Digester3-3.2 and in new jar I don't see any method as createDigester(ur);
How can I replace DigesterLoader.createDigester(url) using new API to get Digester object in return.
commons-digester:3.2 code
URL url;
ClassLoader curClassLoader = this.getClass().getClassLoader();
url = curClassLoader.getResource("filepath");
if (url != null) {
Digester tempDigester = ???;
----
----
}
Thanks in advance.
Haven't checked exactly what the 1.8 version does, but assuming your URL resolves to a stream of XML based rules then something like this should do the trick:
Note you probably have to make your URL final to use it within the anonymous subclass.
Tested with the following simple rules file:
Requires the DOCTYPE declaration, but works with or without the XML declaration. Running without the DOCTYPE gives: