/** * Creates a new exception for a parsing error that occured in a StAX-based parsing method. * * @param xmlReader * {@link XMLStreamReader} that encountered the erroneous event * @param msg * error information that explains the problem */ public XMLParsingException( XMLStreamReader xmlReader, String msg ) { this.msg = msg; this.errorPosition = new XMLErrorPosition( xmlReader ); }
@Override public String getMessage() { return "Error in XML document (" + ( ( errorPosition != null ) ? errorPosition.getAsMessage() : "Unknown error position" ) + "): " + msg; } }
@Override public String toString() { return getAsMessage(); } }
/** * Creates a new exception for a parsing error that occured in an AXIOM-based parsing method. * * @param origin * {@link XMLAdapter} that determined the error (usually use <code>this</code>) * @param erroneousElement * element that contains the error * @param msg * error information that explains the problem */ public XMLParsingException( XMLAdapter origin, OMElement erroneousElement, String msg ) { this.msg = msg; this.errorPosition = new XMLErrorPosition( origin, erroneousElement ); }