commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Frank W. Zammetti" <>
Subject Re: [Digester] Unable to get validation working
Date Tue, 26 Apr 2005 03:12:08 GMT
Whew!  Got it!

Wendy, you WERE right, at least partially, in terms of the point on 
pathing... what I wound up doing was putting the DTD in a JAR in the 
webapp lib directory, so it's of course in the path.  In the code I do:

URL cURL = this.getClass().getResource("my/app/myConfig.dtd");
digester.register("myConfig", cURL.toString());

...where the path in the getResource() call matches the path where the 
DTD is in the JAR.

The last piece of the puzzle though, which took about 45 minutes of 
banging my head on the desk to figure out, was the DOCTYPE definition in 
the XML file I was trying to validate.  I had to use:

<!DOCTYPE myConfig PUBLIC "myConfig" "myConfig">

It seemed more logical to use SYSTEM, but it kept trying to pull the 
file from various locations on the local file system, as the name 
indicates).  Even when I tried to get the path to point at the actual 
file in WEB-INF for instance though, it would never work for one reason 
or another.  This, even though it doesn't seem right to me (and maybe 
it's not!) *does* work.

Cool, one step closer to completion!


Frank W. Zammetti wrote:
> That's a good question (what am I expecting to be there)... I don't know 
> actually... I'm either not understanding the documentation, or the 
> documentation isn't as clear as it could be because I'm not really sure 
> what should be there.  I know it accepts a string of course, but beyond 
> that I'm not sure.
> Wendy Smoak wrote:
>> From: "Frank W. Zammetti" <>
>>> digester.register("myconfig",
>>> this.getClass().getResource("my-config.dtd").toString());
>>> Makes sense Wendy... I gave it a shot, but still get the NPE on that
>>> line (must be the toString() call that's actually throwing it).
>> Does it work if you hard-code whatever is supposed to be there?  (What 
>> value
>> are you expecting?)
>> Simon should be along any minute to give you the answer... :)

Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message