Code example for SAXParseException

Methods: getExceptiongetMessagegetLineNumbergetSystemId

0
      //document = builder.parse( new File(fileName)); 
      document = builder.parse(fs);
      return document;
    } catch (SAXParseException spe) {
      // Error generated by the parser 
      System.err.println("\n** Parsing error , line " + spe.getLineNumber()
                         + ", uri " + spe.getSystemId());
      System.err.println(" " + spe.getMessage() );
      // Use the contained exception, if any 
      Exception x = spe;
      if (spe.getException() != null)
        x = spe.getException();
      x.printStackTrace();
    } catch (SAXException sxe) {
      // Error generated during parsing 
      Exception x = sxe;
      if (sxe.getException() != null)
        x = sxe.getException();
      x.printStackTrace();
    } catch (ParserConfigurationException pce) {
      // Parser with specified options can't be built