DTD seach path for Xerxes parser

I am using Struts and the the XML config files refer to the DTD that are stored locally on the same directory as the XML files. I refer to the DTD files from the XML using SYSTEM and the the name of the DTD file without any path element. I am using the Xerxex parser. The parser does not find the DTD and complains of a missing base URL. What am I doing wrong? More importantly, can someone tell me what rules the parser uses when searching for a DTD in a web application as the web applications are hosted by a web container and have only the concept of a context root for its file system. Thanks in advance, Raj Auradkar

But are you certain that at run-time, the XML file it is reading is really the same one you think it is? For example, are you building and running your web app as a WAR file, and the DTD files are *not* in that WAR file? Also, it would probably help if you actually showed your DOCTYPE line from your XML file.

Rajendra Auradkar
Greenhorn

Joined: Jan 28, 2004
Posts: 5

posted Jan 28, 2004 14:01:00

0

Billy, Thanks for your response, you guys are fast!! Here is the info. The DTD is not in the war. Below are 2 versions of the struts-config.xml file for which the parser is whining for a 'base uri'. 1. <!DOCTYPE struts-config SYSTEM "struts-config_1_1.dtd"> In this case the DTD is in the same location as the struts-config.xml 2. <!DOCTYPE struts-config SYSTEM "/webapps/onlineCredit/WEB-INF/lib/struts-config_1_1.dtd"> In this case the struts-config.xml file is in the lib directory of the web app. THanks, Raj Auradkar

Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202

posted Jan 28, 2004 14:06:00

0

Originally posted by Rajendra Auradkar:

The DTD is not in the war.

My point was, if you have a WAR file from which the web app is running, then your DTDs would need to be in it, in the same "folder" as the XML files for that (1st version) doctype to work. Don't use the 2nd version, as that would force every deployment to have a physical directory named what you specified there.

Rajendra Auradkar
Greenhorn

Joined: Jan 28, 2004
Posts: 5

posted Jan 28, 2004 14:23:00

0

Billy, Sorry for the mistake. The web app does not run from a war. Is it deployed in an exploded format. Does that answer the question? Also, do you know what rules are used by the parser when it is searching for DTDs. (i am asusming the parser is context agnostic). Thanks, Raj Auradkar

Billybob Marshall
Ranch Hand

Joined: Jan 27, 2004
Posts: 202

posted Jan 28, 2004 14:32:00

0

Ok, in the exploded deployed directory structure, is the DTD in the same directory as the XML (not necessarily where your original source XML is)? As far as the rules, I believe they are relative directory based (relative to the referring XML). So "blah.dtd" would be expected to be in the same directory as the XML containing that reference. "foo/blah.dtd" would be expected to be in a subdirectory named foo, relative to the directory containing the XML. "/some/path/blah.dtd" would be in physical directory (not relative to the web app AFAIK) /some/path.