java - Save HTMLDocument -


package htmldocsave;  import java.io.ioexception;  import javax.swing.text.badlocationexception; import javax.swing.text.html.*;  import java.io.*;  public class htmldocsave  {     public static void main(string[] args)     {         htmldocument doc = new htmldocument();         htmleditorkit kit = new htmleditorkit();          file f = new file("greeting.html");          try          {             kit.inserthtml(doc,doc.getlength(),"<b>hello</b>",0,0,null);             fileoutputstream fos = new fileoutputstream(f);              ???????????????????????????                     fos.close();         }          catch (badlocationexception | ioexception e)          {             e.printstacktrace();         }      } } 

how save html document on file system? javax.swing.text.html.htmldocument class doesn't override tostring() method , gettext() removes tags.

use htmleditorkit.write() method.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -