org.jsoup.parser.ParseError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsoup Show documentation
Show all versions of jsoup Show documentation
jsoup is a Java library for working with real-world HTML. It provides a very convenient API for extracting and manipulating data, using the best of DOM, CSS, and jquery-like methods. jsoup implements the WHATWG HTML5 specification, and parses HTML to the same DOM as modern browsers do.
package org.jsoup.parser;
/**
* A Parse Error records an error in the input HTML that occurs in either the tokenisation or the tree building phase.
*/
public class ParseError {
private int pos;
private String errorMsg;
ParseError(int pos, String errorMsg) {
this.pos = pos;
this.errorMsg = errorMsg;
}
ParseError(int pos, String errorFormat, Object... args) {
this.errorMsg = String.format(errorFormat, args);
this.pos = pos;
}
/**
* Retrieve the error message.
* @return the error message.
*/
public String getErrorMessage() {
return errorMsg;
}
/**
* Retrieves the offset of the error.
* @return error offset within input
*/
public int getPosition() {
return pos;
}
@Override
public String toString() {
return pos + ": " + errorMsg;
}
}