Solved

Java & XML: XML decoding and Java Programming

Posted on 2004-10-10
10
190 Views
Last Modified: 2010-03-31
I've got an xml file with the following syntax:
<?xml version="1.0" encoding="iso-8859-1"?>
<data>
      <topic1>
            <topicname>TOPIC1</topicname>
            <link1>
                  <url>http://www.something.net/</url>
                  <urltext>something</urltext>
                  <description>something somewhat somewhere</description>
                  <imageurl>images/something.jpg</imageurl>
            </link1>
      </topic1>
      <topic2>
            <topicname>TOPIC2</topicname>
            <link1>
                  <url>http://www.somewhat.net/</url>
                  <urltext>somewhat</urltext>
                  <description>somewhat somewhere</description>
                  <imageurl>images/somewhat.jpg</imageurl>
            </link1>
      </topic2>
      <topic3>
            <topicname>TOPIC3</topicname>
            <link1>
                  <url>http://www.somewhere.net/</url>
                  <urltext>somewhere</urltext>            
                  <description>somewhere</description>
                  <imageurl>images/somewhere.jpg</imageurl>
            </link1>
      </topic3>
</data>

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.
eX.



0
Comment
Question by:Gaute Rønningen
  • 6
  • 4
10 Comments
 
LVL 86

Expert Comment

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

Could you explain this a bit more?
0
 

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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12272026
>>should dynamically update

In what way and why?
0
ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

 

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?
0
 
LVL 86

Expert Comment

by:CEHJ
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
0
 
LVL 86

Expert Comment

by:CEHJ
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
0
 

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.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 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:

http://javaalmanac.com/egs/

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

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...)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12284927
8-)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javap bin 2 36
eclipse buid path vs tomcat lib path 10 24
throw exception 21 45
Facing this issue for maven proxy setting 2 13
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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 learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

825 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