/**
* Parses this document.
*/
public void parse() throws IOException {
HTMLEditorKit html = new HTMLEditorKit();
Reader urlReader = null;
try {
urlReader = new InputStreamReader(getBase().openStream(), "ISO-8859-1");
// Parse HTML file first without ignoring charset directive
putProperty("IgnoreCharsetDirective", Boolean.FALSE);
try {
html.read(urlReader, this, 0);
} catch (ChangedCharSetException ex) {
// Retrieve document real encoding
String mimeType = ex.getCharSetSpec();
String encoding = mimeType.substring(mimeType.indexOf("=") + 1).trim();
// Restart reading document with its real encoding
urlReader.close();
urlReader = new InputStreamReader(getBase().openStream(), encoding);
putProperty("IgnoreCharsetDirective", Boolean.TRUE);
html.read(urlReader, this, 0);
}
} catch (BadLocationException ex) {
} finally {
if (urlReader != null) {
try {