Im coding in Java..
Does anyone know how i can get the content of a javax.swing.text.html.HTMLDocument as a String? This is what i´ve got so far...
URL url = new URL( "http://www.test.com" );
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument();
doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
Reader HTMLReader = new InputStreamReader(url.openConnection().getInputStream());
kit.read(HTMLReader, doc, 0);
I need the content of the HTMLDocument as a String.
Example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
....... etc.
Any help would be appreciated. I need to use HTMLDocument class in order for the html to be processed correctly :)
Thanks Daniel