Link to home
Start Free TrialLog in
Avatar of Gaute Rønningen
Gaute RønningenFlag for Norway

asked on

Java & XML: XML decoding and Java Programming

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.



Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

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

Could you explain this a bit more?
Avatar of Gaute Rønningen

ASKER

The right column (JTextArea or something) should dynamically update as one moves the mouse over a link on the left one.
>>should dynamically update

In what way and why?
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?
>>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
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
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.
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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...)
8-)