Hi dIon

A common way around this is to implement a SAX EntityResolver to load the
DTD from somewhere else. e.g. you could include the DTD in your JAR with
your java code and load it from there.

EntityResolver resolver = new EntityResolver() {
    public InputSource resolveEntity(String publicId, String systemId) {
        if ( publicId.equals( "-//Acme//DTD Foo 1.2//EN" ) ) {
            InputStream in = getClass().getResourceAsStream(
                "com/acme/foo.dtd"
            );
            return new InputSource( in );
        }
        return null;
    }
};

SAXReader reader = new SAXReader();
reader.setEntityResolver( resolver );
Document doc = reader.parse( "foo.xml" );

James
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 15, 2002 1:47 AM
Subject: [dom4j-user] DTDs and Proxies


> How do I tell dom4j to use a proxy to fetch a system DTD definition, e.g.
> for web.xml the URL is at http://java.sun.com/.... ?
> --
> dIon Gillard, Multitask Consulting
> Work:      http://www.multitask.com.au
> Developers: http://adslgateway.multitask.com.au/developers
>
>
> _______________________________________________________________
>
> Have big pipes? SourceForge.net is looking for download mirrors. We supply
> the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


_______________________________________________________________

Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to