final XMLReader reader = new SAXParser();
// Construct an entity resolver that looks in the JAR that
// contains the same class as this class, and use it to look
// up the XML file
final JarFileEntityResolver resolver = new JarFileEntityResolver(this);
// add the mapping for the style-catorgories.xml file.
resolver.addSystemIdMapping(
STYLE_CATEGORIES_XML_URI,
STYLE_CATEGORIES_XML_LOCATION);
// add the mapping for the style-catorgories.xsd file.
resolver.addSystemIdMapping(
STYLE_CATEGORIES_SCHEMA_URI,
STYLE_CATEGORIES_SCHEMA_LOCATION);
final InputSource xmlInputSource =
resolver.resolveEntity(null, STYLE_CATEGORIES_XML_URI);
// Create a content handler and attach it to the reader
final StyleCategoryContentHandler handler =
new StyleCategoryContentHandler();
reader.setContentHandler(handler);