You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Katarzyna Marszalek <ka...@heliosnet.pl> on 2002/11/11 15:39:05 UTC

Propagating entity resolvers down to the schema parser

In my application a custom EntityResolver handler, set for a SAX parser, is
not propagated to the schema handler (this is for the latest version, 2.2.0
of Xerces.)  As the result of this there are always HTTP connections made to
retrieve http://www.w3.org/2001/XMLSchema.dtd, since the schema file has
doctype of:

<!DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
                        "http://www.w3.org/2001/XMLSchema.dtd"[
]>

Am I missing something, or is this by design and there are some other ways
to force the parser to use the custom entity resolver?

Regards,
Katarzyna Marszalek

P.S. For now, I was able to get around the problem by modifying
org.apache.xerces.impl.xs.traversers.XSDHandler.java, adding the following
code to the getSchema method:


                    fSchemaParser = new DOMParser();
                    if( fEntityResolver != null ) {
                        try {

fSchemaParser.setProperty("http://apache.org/xml/properties/internal/entity-
resolver",fEntityResolver);
                        } catch(Exception e) {
                            e.printStackTrace(System.err);
                        }
                    }



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org