Convert XML to HTML and display on to JEditorPane

Posted on 2003-03-15
Medium Priority
Last Modified: 2012-06-21
I have A code to convert XML to HTML like

Document doc = buildDocument();
File styleSheet=new File("makehtml.xsl");
StreamSource styleSource=new StreamSource(styleSheet);
Transformer t = TransformerFactory
ByteArrayOutputStream bout = new ByteArrayOutputStream();
t.transform(new DOMSource(doc), new StreamResult(bout));

Now I want to display the HTML in a JEditorPane. My current code is like

ByteArrayInputStream bin = new ByteArrayInputStream(data);
JEditorPane editorPane=new JEditorPane();
editorPane.read(bin, new HTMLDocument());

but this displays the source code(tags) of HTML. How can I display the html correctly?
Question by:csound
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 86

Expert Comment

ID: 8142517
Have you called


LVL 86

Accepted Solution

CEHJ earned 500 total points
ID: 8142520


should have been


Author Comment

ID: 8142552
oh... I didn't. It works now thanx. Can I ask one more question please? I've just noticed that the JEditorPane didn't display a table. It displayed information in tabular form but didn't display borders. Whay is this?
LVL 86

Expert Comment

ID: 8142687
I'm afraid the html support is very limited, so it wouldn't surprise me if table borders were not supported.

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month10 days, 4 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question