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

html4.x support within a JEditorPane

    XMLWordPrintable

Details

    • Fix Understood
    • generic, x86, sparc
    • generic, linux, solaris, solaris_7, solaris_8, solaris_9, windows_98, windows_2000, windows_xp

    Description

      Name: skT88420 Date: 12/01/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, native threads, symcjit)

      How are you doing? It would be great if someone could add support to the
      JEditorPane which would allow it to display XML content ( XML Document and
      its associated XSL(s) ). I understand that the XML parser does exist but
      it doesn't allow me to display the XML content of a well formed document as
      it would look to an end-user. In the long run, the JEditorPane should be
      able to deal with the following formats as defined by W3C:

      o HTML 4 or XHTML
      o XML and its associated XSL(s)
      (Review ID: 98508)
      ======================================================================

      Name: krT82822 Date: 01/29/2000


      java version "1.3.0rc1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
      Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

      World Wide Web Consortium?iW3C?jshows the spec of XHTML1.0
      and popular web browsers are supporting HTML4.0
      But Swing supports only HTML3.2

      In these days, web computing is getting more vital.

      JavaHelp 1.1 has poor ability to show HTML because it use Swing component(
      JEditorPane )

      Swing should support HTML4.0 and XHTML1.0
      (Review ID: 100503)
      ======================================================================

      Name: krC82822 Date: 12/14/2000


      $ java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


      1. Exact steps to reproduce the problem.
      Load any XHTML file into the JEditorPane

      2. Java SOURCE CODE that demonstrates the problem, if possible.
      import java.awt.*;
      import java.awt.event.*;
      import java.io.*;
      import java.net.*;
      import javax.swing.*;
      import javax.swing.event.*;

      public class Browser {
      public static void main(String[] args) {
      Browser b = new Browser();
      try {
      b.setPage(new URL(args[0]));
      } catch (Exception e) {
      try {
      b.setPage(new File(args[0]).toURL());
      } catch (Exception e2) {
      System.err.println(e2);
      }
      }
      }
      private Object root; // JWindow or JFrame, cast on Component-Window or
        RootPaneContainer
      private JEditorPane edit;
      private JScrollPane scroller;
      private boolean fullscreen=true;
      public Browser() {
      if (fullscreen) root=new JWindow();
      else root=new JFrame("Browser");
      ((Component)root).setSize(Toolkit.getDefaultToolkit
      ().getScreenSize());
      edit=new JEditorPane();
      edit.setEditable(false);
      scroller=new JScrollPane(edit);
      ((RootPaneContainer)root).getContentPane().add(scroller);
      ((Component)root).setVisible(true);
      }
      public void setPage(String url) throws MalformedURLException,
      IOException {
      edit.setPage(new URL(url));
      }
      public void setPage(URL url) throws IOException {
      edit.setPage(url);
      }
      }

      3.1 Additional Source Codes if neccessary:
      An Example XHTML page demonstrating the problem:
      <?xml version="1.0" encoding="iso-8859-1"?>
      <!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0
      Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
      <title>Simple XHTML page</title>
      </head>
      <body>
      <h1>Problem</h1>
      <p>
      Now a new line
      <br />
      That's the new line
      </p>
      </body>
      </html>

      3. Exact text of any error message(s) that appeared.
      No error messages
      3.1 Problem
      The file displays wrong.
      The <br /> displays a /.
      The XML Declaration <?xml version="1.0" encoding="iso-8859-1"?> displays.

      4. Any trace information
      No trace information

      5. Configuration
      JEditorPane, XHTML. That's all you need to reproduce this.

        Suggested Solution:
      1st step: Change parsing to treat <..> as tag always. That's not correct in
      case of <?...?> since <?...?> really is not a tag, but that doesn't matter for
      now.

      2nd step: Change parsing to use SaX. If SaX reports an error, run the file
      through HTMLTidy to convert HTML 4.01 to XHTML 1.0 and try again. Parsing
      should be much easier this way.
      (Review ID: 113820)
      ======================================================================

      Name: rmT116609 Date: 02/28/2001


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, native threads, symcjit)



      We can display HTML pages in a JEditorPane. But now a days many URLs are either
      xml or .asp files. many times flash is used instead of HTML. So is there method
      to display these file types in JEditorPane ?
      (Review ID: 117828)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              peterz Peter Zhelezniakov
              skonchad Sandeep Konchady
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Imported:
                Indexed: