JDK-4296022 : html4.x support within a JEditorPane
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version:
    1.1.8,1.2.0,1.2.2,1.3.0,1.3.0_01,1.3.1_06,1.4.0,1.4.1,1.4.2,5.0,6,6u12,7 1.1.8,1.2.0,1.2.2,1.3.0,1.3.0_01,1.3.1_06,1.4.0,1.4.1,1.4.2,5.0,6,6u12,7
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS:
    generic,linux,solaris,solaris_7,solaris_8,solaris_9,windows_98,windows_2000,windows_xp generic,linux,solaris,solaris_7,solaris_8,solaris_9,windows_98,windows_2000,windows_xp
  • CPU: generic,x86,sparc
  • Submitted: 1999-12-01
  • Updated: 2009-07-08
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
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)
======================================================================

Comments
EVALUATION We are planning to resolve this problem in the Dolphin (J2SE 7.0) release. To make sure all the important features are implemented we need your help. We've created a survey to help us to understand your needs better: http://java.sun.com/webapps/survey/display?survey_id=5370 (It might take about fifteen minutes to finish it.) Thank you for your time.
18-11-2005

EVALUATION This is something we are strongly considering for dolphin.
27-10-2005

WORK AROUND Name: skT88420 Date: 12/01/99 None. ======================================================================
02-10-2004

EVALUATION This would be an useful thing to support better. We will investigate improving support in this area for merlin. timothy.prinzing@eng 2000-03-22
22-03-2000