Link to home
Start Free TrialLog in
Avatar of harlanhugh
harlanhugh

asked on

Setting SetEntityResolver with SAXParser

I have the following code to set the XMLParser entity resolver

saxParser.getXMLReader().setEntityResolver(new CustomEntityResolver());

The CustomEntityResolver looks something like this

public InputSource resolveEntity(String publicId, Strprivate class CustomEntityResolver implements EntityResolver {
  public InputSource resolveEntity(String publicId, String systemId) {
    System.out.println("Resolving: "+systemId);
    .....
}

However that system.out statement never gets called. Can someone please explain how I can fix this. Basically we are trying to get the SaxParser not to crash if they have do not have Internet access and supplying the location of the local file.

Thanks in advance
Avatar of harlanhugh
harlanhugh

ASKER

I solved this one.  Need to override the resolveEntity for the DefaultHandler.
ASKER CERTIFIED SOLUTION
Avatar of EE_AutoDeleter
EE_AutoDeleter

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial