This should be a pretty simple question.  Running the following code:
 
 
    try {
      XMLReader parser = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
      parser.setContentHandler(contentHandler);
      parser.setErrorHandler(errorHandler);
      parser.setEntityResolver(new FeedEntityResolver(dtdPath));
      parser.setFeature("http://xml.org/sax/features/validation", true);
      try {
        parser.parse(uri);
      }
      catch (IOException e) {
        throw new FeedException("IOException, error reading URI: " + e.getMessage(), e);
      }
      catch (SAXException e) {
        e.printStackTrace();
        throw new FeedException("Error in parsing: " + e.getMessage(), e);
      }
    }
    catch (SAXException e) {
      throw new FeedException("Unable to create parser.", e);
    }
where
contentHandler is a valid ContentHandler
errorHandler is a valid ErrorHandler
FeedEntityResolver is a valid Entity Resolver
uri is a valid absolute filename.
 
I am having the following Exception thrown:
 
java.lang.NullPointerException
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:878)
 at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:900)
 
No methods on my ErrorHandler, ContentHandler, or EntityResolver are ever getting called.  Does anyone have any idea what I am missing?  The problem seems to be contained within the parser code....
 
Any help is greatly appreciated.
 
Brad

Reply via email to