After struggling with a digester problem all day, I finally found a posting 
that was about 1 ½ years old that help solve my problem - but I would like to 
see if someone can provide an explanation so that I can learn and understand 
what was happening.

 

The problem:  I have several files that I am processing with the digester.   
The xml files and the dtd reside in the same directory within my web 
application.  The first couple of lines of one of the files is shown below - 
using only a SYSTEM id. 

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE root SYSTEM "ReportType.dtd">

 

<root>

...

 

When calling digester.parse() using a File object,  the call results in a 
"UnknownHostException c"  where c is the windows drive where my files are 
located - apparently the systemId was generated as 
file://c/mydir/conf/creport/reporttypes/ReportType.dtd 
<file:///\\c\mydir\conf\creport\reporttypes\ReportType.dtd>  and the c is 
interpreted as a machine/host name.

 

Changing the code to call digester.parse() with the String parameter providing 
the full path of the file works.

 

Looking at the Digester code, I guess this may be more of a SAX question 
because I can see where the parse() methods convert their input into an 
InputSource, but why does the parse() version with a File call the 
setSystemId()?

 

Thanks in advance!

Reply via email to