Java & XML: XML decoding and Java Programming

Posted on 2004-10-10
Medium Priority
Last Modified: 2010-03-31
I've got an xml file with the following syntax:
<?xml version="1.0" encoding="iso-8859-1"?>
                  <description>something somewhat somewhere</description>
                  <description>somewhat somewhere</description>

I need a Java applet to use on my website (sized 472px * 282px)
Which is supposed to read the xml file and put the links and all it's info onto site.

I've been thinking the applet should have 2 col. one on each side of applet (EAST and WEST)
- The left one should have the <topics> with their <urltext> and should be able to goto the <url> when clicked.
- The right one should update on mouseover the links on the left. It's design would have an image (sized 100px * 73px) on top, followed by "URL: <url>", "Text: <urltext>" and "Description: <description>"

I'm not expecting a complete solution from EE members, but I hope for a little help to get me going.

Thanks in advance.

Question by:Gaute Rønningen
  • 6
  • 4
LVL 86

Expert Comment

ID: 12271882
>>The right one should update on mouseover the links on the left.

Could you explain this a bit more?

Author Comment

by:Gaute Rønningen
ID: 12271988
The right column (JTextArea or something) should dynamically update as one moves the mouse over a link on the left one.
LVL 86

Expert Comment

ID: 12272026
>>should dynamically update

In what way and why?
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.


Author Comment

by:Gaute Rønningen
ID: 12272053
When you move the mouse over a link, the fields on the right should update, using the data from the xml file. To show a description of the link and a preview of the site through an image.

Why? Because I've seen it done on other sites, and want it on mine... (I don't know if they used xml, but still) Sadly I cannot remember which sites...

I'm not sure what you meant by that question, but I tried to answer at the best of my knowledge.

I'll post a simple image of how I want it if you'd like?
LVL 86

Expert Comment

ID: 12272071
>>I'll post a simple image of how I want it if you'd like?

No - it's OK - i've got the picture now - i'll have a think
LVL 86

Expert Comment

ID: 12272094
This is what i'd do:

a. Use a JEditorPane for the left pane
b0. Parse the xml document in a DOM way
b1. Make a Map of descriptions using the links as keys and the descriptions as values
b3. Use the Java transform package to transform the xml into html
c. Add the html as a String to the left pane
d. Add HyperlinkListeners to the links
e. Change the content of the right pane when the HyperlinkListener fires

Author Comment

by:Gaute Rønningen
ID: 12272142
I feel bad for asking you this, because you probably have more important things to do.
But on the other hand I'm kinda new to Java... Meaning I know some simple things about GUI and JDBC and that's it.

a. I've never used JEditorPane, but I guess the API explains it.
b0. The only thing I've used DOM in before was in VBA. So I could use some kind of tutorial.
b1. Need tutorial.
b3. In the back of my head somewhere.
c. Same as above.
d. Need tutorial.
e. Need tutorial.
LVL 86

Accepted Solution

CEHJ earned 1000 total points
ID: 12272173
I can point you in the right direction. I would take it bit by bit. Get stand alone parts working that you can later integrate into the complete solution. Start here:


Look at the links right at the end of the page, then you can start looking at JEditorPane in the javax.swing section

Author Comment

by:Gaute Rønningen
ID: 12276346
I'm sorry, but I've decided to put this project on ice, and focus on school instead.

Anyways I thank you for helping and award you all the points.

(As for my website, I went for a standard Flash menu template, based on XML...)
LVL 86

Expert Comment

ID: 12284927

Featured Post

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

588 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