Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4143348

HTMLEditorKit.write(...) does not write <HEAD> part of html document.

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5.1
    • Verified



      Name: aaC67449 Date: 05/28/98



      HTMLEditorKit.write(...) does not write <HEAD> part of html document.

      This bug is introduced in JDK1.2-beta4G.

      ------------------Example-----------------------------------
      import java.awt.swing.text.html.*;
      import java.awt.swing.text.*;
      import java.io.*;
      public class Test {

         public static void main(String argv[]) {
           String test="<!DOCTYPE HTML PUBLIC \"-//w3c//DTD html 3.2//EN\"><HTML><HEAD><TITLE>test</TITLE><HEAD><BODY><P>Test</P></BODY></HTML>";
           
              HTMLEditorKit c= new HTMLEditorKit();
              Document doc=c.createDefaultDocument();
              try {
                 c.read(new StringReader(test),doc,0);
                 StringWriter sw= new StringWriter();
                 c.write(sw,doc,0,4);
                 System.out.println(sw.toString());
              } catch(Exception e) {
                  e.printStackTrace();
              }
        
         }

      }
      -------------------Output------------------------------------
      <html>
        <body>
          <p>
            Test
          </p>
        </body>
      </html>

      ======================================================================

            smanisunw Sunita Mani (Inactive)
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: