[jdom-interest] DTD location

Michael Kay mike at saxonica.com
Tue Nov 14 15:27:06 PST 2006


Make sure that the SAXBuilder knows the base URI of windsor.xml. That is,
use one of the build() methods that supplies a systemId, or a URL, or a
File, or an InputSource containing a SystemId or a File; but not a plain
InputStream or Reader, which is just a stream of characters or bytes giving
the builder no information about where they came from.

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: jdom-interest-bounces at jdom.org 
> [mailto:jdom-interest-bounces at jdom.org] On Behalf Of Syloke Soong
> Sent: 14 November 2006 22:08
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] DTD location
> 
> 
> I have a folder in a netbeans webapp.
> 
> /NB-Projects/whatever/app/WEB-INF/fistx/ .
> 
> In that folder I have two files.
> windsor.xml and its dtd fist.dtd .
> 
> windsor.xml starts with these two lines:
> 
> <?xml version="1.0" ?>
> <!DOCTYPE fist SYSTEM "fist.dtd" >
> 
> 
> However, SAX builder keeps insisting on wanting to read the 
> fist.dtd from /..../netbeans/tomcat5.5.7/bin .
> 
> Is there a way to tell SAX builder to look for the DTD at the 
> directory where the xml file is being parsed?
> 
> Or at any location I wish to specify, 
> 
> [pseudo-code]
> String fistdtd =
>  session.getServletContext()
>   .getRealPath("/WEB-INF/fistx/fist.dtd");
> 
> SAXBuilder saxb = new SAXBuilder();
> saxb.setValidation(fistdtd);
> [/pseudo-code]
> 
> Additionally,
> 
> [pseudo-code]
> saxb.setValidation(
>   "http|ftp ://MyFavouriteServer/myFavouriteDTDs/fist.dtd");
> [/pseudo-code]
> 
> 
> I could specify
> <!DOCTYPE fist SYSTEM 
> /NB-Projects/whatever/app/WEB-INF/fistx/fist.dtd"
> >
> 
> But that would not be very portable, would it?
> 
> This email and any files transmitted with it are confidential 
> and intended solely for the use of the individual or entity 
> to whom they are addressed. If you have received this email 
> in error please notify the sender immediately. Please note 
> that any views or opinions presented in this email are solely 
> those of the author and do not necessarily represent those of 
> the company. Even though this company takes every precaution 
> to ensure this email is virus-free, the recipient should 
> check this email and any attachments for the presence of 
> viruses. The company accepts no liability for any damage 
> caused by any virus transmitted by this email.
> Protedyne Corporation, 1000 Day Hill Rd, Windsor, CT 06095, 
> USA,                                                                  
> www.protedyne.com
> 
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@you
> rhost.com



More information about the jdom-interest mailing list