Skip to main content

displaying xhtml

4 replies [Last post]
joesephjava
Offline
Joined: 2006-04-06

Good job on JEditorPane. Every year as one of the weekly class projects, my students each produce a mini-broswer using JEdtorPane. The CSS rendering is much improved from 1.5 to 1.6. The class web site is made up of XHTML 1.0 Strict web-pages. Every page has an XML declaration followed by a DOCTYPE:
<?xml version="1.0" encoding="UTF-8"?>

Everything looks great (all rendering is OK), EXCEPT the XML declaration at the top of each web-page is shown (along with the correctly rendered page): i.e
<?xml version="1.0" encoding="UTF-8"?>
is at the top of each page.

JEditorPane displays HTML and makes no mention of XHTML, therefore this is not really a bug. JEditorPane does a very good job displaying XHTML documents.

Technically the XML declaration is optional, and if not included the displayed pages look great. I suggest that the XML declaration, if included in a document, NOT be displayed when the document is rendered.

Joe

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
leouser
Offline
Joined: 2005-12-12

have you checked out flying saucer for your xhtml rendering?
https://xhtmlrenderer.dev.java.net/
leouser

joesephjava
Offline
Joined: 2006-04-06

Yes, I am aware that flying saucer could be used for the xhtml rendering (but the table support is not as good).
Standard JEditorPane (as of 1.6) does a very good job of displaying XHTML with pretty good CSS support. The main problem seems to be that the XML declaration is not handled correctly.

davidbrowne
Offline
Joined: 2003-06-11

I don't know if this is helpful, but I saw this article yesterday: http://www.xml.com/pub/a/2006/08/02/using-xslt-to-fix-swing.html

joesephjava
Offline
Joined: 2006-04-06

Thank you for your help. The article was interesting, but does not present a solution that I am interested in implementing.