Code example for SAXParseException

Methods: getLineNumber, getMessage, printStackTrace

0
			// parse the input 
			SAXParser saxParser = factory.newSAXParser();
			saxParser.parse(input, handler);
		} catch (SAXParseException e) {
			// report the exception and return false 
			e.printStackTrace();
			System.err.print("ERROR : " + e.getMessage());
			System.err.println((e.getLineNumber() > 0 ? (" (line "
					+ e.getLineNumber() + ")") : ""));
			return false; 
		} catch (Exception e) {
			// report the exception and return false 
			// e.printStackTrace(); 
			System.err.println("ERROR : " + e.getMessage());
			return false; 
		} 
 
		// the parse has succeeded 
		return true; 
	}