Catalog resolvers are available for various programming languages. The following example shows how, in Java, a
SAX parser may be created to parse some input source in which the org.apache.xml.resolver.tools.CatalogResolver is used to resolve external entities to locally cached instances. This resolver originates from
Apache Xerces but is now included with the Sun Java runtime. It is necessary to create a SAXParser in the standard way by using factories. The XML reader entity resolver should be set to the default or to a customly-made one. final SAXParser saxParser = SAXParserFactory.newInstance().newSAXParser(); final XMLReader reader = saxParser.getXMLReader(); final ContentHandler handler = ...; final InputSource input = ...; reader.setEntityResolver(new CatalogResolver()); reader.setContentHandler(handler); reader.parse(input); It is important to call the parse method on the reader,
not on the SAX parser. ==External references==