[jdom-interest] External DTD
Joe Drury
jvdrury at yahoo.com
Mon Aug 13 13:49:19 PDT 2001
In your entity resolver you would then override the
resolveEntity method. The example below is used to
resolve dtd's in a dtd directory relative to the local
classes.
public InputSource resolveEntity(String publicId,
String systemId) throws SAXException
{
InputSource source;
try {
int i = systemId.lastIndexOf("/") + 1;
String fileName = systemId.substring(i,
systemId.length());
String filePath = "./dtd/" + fileName;
source = new InputSource(
new BufferedReader(
new FileReader(
new File(filePath))));
}
catch (FileNotFoundException f)
{
f.printStackTrace();
}
return source;
}
--- Alex Rosen <arosen at silverstream.com> wrote:
> Look at the EntityResolver interface in SAX. You can
> call
> builder.setEntityResolver() to install your own.
>
> Alex
>
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of
> Lau, Lai
> Sent: Thursday, August 02, 2001 8:12 PM
> To: 'jdom-interest at jdom.org'
> Subject: [jdom-interest] External DTD
>
>
>
> Hi All,
>
> I have a question regarding how to turn off the
> validation for DTD. I
> build a JDOM document by using the following:
>
> String saxDriverClass =
> "org.apache.xerces.parsers.SAXParser";
> builder = new SAXBuilder (saxDriverClass, false);
> Document doc = builder.build(filename);
>
> However, when we put an external URL (outside our
> company firewall), we
> received Java Null pointer exception during the
> build. So, I tried
> adding : builder.setValidation(false), it will cause
> system timeout.
> Seems to me the command above did not actually turn
> off the validation.
>
>
> Our input (xml document) is from an outside source
> and will contain an
> external URL in the <!Doctype for sure. Any
> recommendation?
>
> Thank you!
> Lai Lau
> Developer, B2B eBusiness
> Information Technology
> 425-580-6319
> Lai.Lau at attws.com
>
>
__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
More information about the jdom-interest
mailing list