How to properly reference a DTD?

View: New views
1 Messages — Rating Filter:   Alert me  

How to properly reference a DTD?

by Christopher Maier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to use a DTD for my datasets, but I am having trouble  
referring to it in the XML files properly.

I have a directory structure that looks somewhat like this:

PROJECT
        \___Testing
                \___my.dtd
                \___datasets
                        \___dataset_a.xml

In a nutshell, I have a 'Testing' directory with all my testing  
resources.  Immediately within 'Testing' I have my DTD and several  
folders containing datasets (these folders mirror the package  
structure of my test classes for organizational purposes).

My problem is this: when I'm editing dataset_a.xml, I have a doctype  
declaration like this:

<!DOCTYPE dataset SYSTEM "../my.dtd">

that references the DTD in a relative fashion, then my editor can  
resolve the DTD fine and I can confirm that the dataset xml file is  
valid.  However, when I'm running my tests from the root directory of  
the project, the DTD gets resolved relative to that directory, and not  
relative to the file.  Since the doctype declaration says the DTD is  
at "../my.dtd", it looks for the DTD in the directory above my project  
root.  It doesn't find it there, so the tests fail.

Is there any way that I can refer to the DTD so that my tests will  
resolve it properly?  Perhaps a programmatic way in my DBUnit test  
cases to validate against a DTD on the classpath?

I appreciate any help!

Thanks,

--------------------------------------------------------------------------------------------
Christopher Maier
Research Associate
Giddings Laboratory
UNC Department of Microbiology & Immunology

maier@...


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
dbunit-user mailing list
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user
LightInTheBox - Buy quality products at wholesale price