Hi folks.
I've got a servlet (actually a couple) that are doing some XML parsing
(Mainly SAX, some DOM).
The only problem I seem to be having is that when if I have a XML file
that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglist SYSTEM "taglist.dtd">
Tomcat looks for the DTD file in the TOMCAT_HOME/bin directory. the
XML and DTD files are in my WEB-INF/classes part of my class path.
>From what I understand of XML, using the
<!DOCTYPE ... SYSTEM "file.dtd">
where the dtd file is given as a URI with no path, the parser should
look for the DTD file in the same directory as the XML file.
It's probably something stupid on my part. I'm creating the InputSource
using an input stream which I instantiate using "getResourceAsStream()",
(which is probably where I'm going wrong).
InputStream ist = FormattedTextWidgetStub.class.getResourceAsStream (
ATTR_TAGFILE );
InputSource iso = new InputSource ( ist );
parser.parse ( iso );
Is there a better way to get the InputSource? or is there any other
way i can get tomcat to look for my DTD file in the same directory as my
XML file (considering that I must keep my XML and DTD files in my
classpath (under the WEB-INF/classes directory somewhere)?
thanks very much.
...alex...