# [jdom-interest] Finding the DTD

Jon Klinginsmith jklinginsmith at DigiTerra.com
Thu Jul 26 12:19:35 PDT 2001

Group,
I am currently taking an XML String and building a JDOM Document by using the SAXBuilder.build(Reader) method.  I instantiate the SAXBuilder by calling the SAXBuilder(boolean) constructor and set validation to true.  I have been able to parse and create the document when the DTD is within the XML text, but I get the following Exception when I try to reference an external DTD:

org.jdom.JDOMException: Error on line 1: Relative URI "C:\testing\item_validation_request.dtd"; can not be resolved without a document URI.

I am trying to determine what my <!DOCTYPE ...> element should look like (specifically the publicID and the systemID)
and I would like to eventually make reference to this DTD with an relative path instead of the absolute path.
Currently my DOCTYPE looks like the following:
<!DOCTYPE REQUEST_ITEM_VALIDATION SYSTEM "C:\testing\item_validation_request.dtd" >

I notice in the documentation that there is a SAXBuilder.build(Reader, String) method, but I have not been successful implementing this method as well.

Can anyone provide me with some insight on how I should reference this external DTD in my XML String?