BuildException be = new BuildException(e.getMessage());
String sep = System.getProperty("line.separator"); String msg = sep + e.getMessage() + sep + "on line " + exLineNo; BuildException be = new BuildException(msg);
	public void execute() throws BuildException	{		try {			System.out.println("Validating: " + xmlPath);			SAXParserFactory spf = SAXParserFactory.newInstance();			spf.setValidating(true);			spf.setNamespaceAware(true);			SAXParser parser = spf.newSAXParser();			XMLReader reader = parser.getXMLReader();			reader.setFeature("http://apache.org/xml/features/validation/schema", true); 			reader.setContentHandler(new DefaultHandler());			reader.setErrorHandler( new ErrorHandler() {											public void error(SAXParseException exception) {					if (exceptionLevel < ERROR) {						ex = exception;						exceptionLevel = ERROR;					}				}								public void fatalError(SAXParseException exception) {					if (exceptionLevel < FATAL) {						ex = exception;						exceptionLevel = FATAL;					}				}								public void warning(SAXParseException exception) {					if (exceptionLevel < WARN) {						ex = exception;						exceptionLevel = WARN;					}				}			});			reader.parse(new InputSource( xmlPath ));			if (ex != null)				throw ex;		}		catch (Exception e) {			if (failOnError) {				BuildException be = new BuildException(e.getMessage());				be.setStackTrace( e.getStackTrace());				throw be;			}			else {				e.printStackTrace();			}		}			}