[jdom-interest] How do specify a DTD?

Kenneth Ellefsen kellefsen at bergen.oilfield.slb.com
Tue Nov 19 00:20:22 PST 2002


Hi,

m_doc = builder.build( file, "/path/to/dtdfile/file.dtd")

2nd argument is a URI, so of course it has to be

m_doc = builder.build( file, "file:/path/to/dtdfile/file.dtd")

in my case. :)

Cheers

On Fri, 2002-11-15 at 22:25, Jason Hunter wrote:
> You can use an EntityResolver, but the easier way is to pass in
> something other than a stream.  A stream naturally doesn't include
> location information but a File does.  So pass in the file, and then the
> parser can find resolve relative paths.
> 
> -jh-
> 
> Kenneth Ellefsen wrote:
> > 
> > Hi.
> > 
> > If you have a xml file with a DOCTYPE tag specifying a dtd file, is it
> > an absolute requirement that the dtd file must be in the same directory
> > as the xml file?
> > 
> > Or is it possible at run time to tell the builder where the dtd file is
> > located?
> > 
> > I tryed the following:
> > 
> > FileInputStream file = new FileInputStream(m_filename);
> > m_doc = builder.build( file, "/path/to/dtdfile/file.dtd")
> > 
> > But is still fails with an Exception saying:
> > External entity not found: "/path/to/dtdfile/file.dtd"
> > 
> > Tips appreciated.
> > 
> > --
> > Mvh,
> > 
> > Kenneth Ellefsen                   | Tlf: (+47) 55985829
> > Schlumberger Information Solutions | www.sis.slb.com
> > 
> > _______________________________________________
> > To control your jdom-interest membership:
> > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com
-- 
Mvh,

Kenneth Ellefsen                   | Tlf: (+47) 55985829
Schlumberger Information Solutions | www.sis.slb.com





More information about the jdom-interest mailing list