One correction....the fatalError method on my ErrorHandler is getting called....but there isn't much detail, just what is below...any ideas?
 
Brad
-----Original Message-----
From: Brad O'Hearne [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 14, 2001 6:53 PM
To: [EMAIL PROTECTED]
Subject: NullPointerException trying to parse a simple XML file.

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