• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Problem validating with DTD from within web app

 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am accessing information configured in an XML file using DOM (in a web application).

I have created a DTD to validate the XML file.
I have put the DTD in the /WEB-INF directory of my web app.

The code that parses the xml from within my web app is not able to locate the DTD during validation.

When I specify the location of the DTD on my file syste e.g. C:\myDTD.dtd, the app is able to locate it but when the location is /WEB-INF/myDTD.dtd, it is not able to.

I have the following questions:
1. How can I specify in my DOCTYPE that the DTD is located in the WEB-INF directory?
2. Do I need to do anything specific in the code to make the DTD availible to the xml processing code in the web app?

Thanks in advance for the help.
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can get the DOCTYPE in the XML file any way you can. I recommend Notepad. As for #2 -- you need to write yourself an EntityResolver. Check out the API docs for more information on that one.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the same problem, if I have a DTD mydefn.dtd

And withing XML file I reference it in XML file as follows

<!DOCTYPE mydefn SYSTEM "dtd/mydefn.dtd">

1) In case of a Java Application, if I place the mydefn.dtd in dtd folder at the root of my application. It works.

2) In case of a Java Web Application it tries to look for mydefn.dtd in bin directory of Tomcat

.....\jakarta-tomcat-5.5.7\bin\dtd\module-config.dtd

What steps to I need to take in my web application to teach it to looking into a some location under the deployment directory ??
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic