Solved

Java & XML: XML decoding and Java Programming

Posted on 2004-10-10
10
182 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 103
unix in java example 9 55
Java Timer (static) 9 36
how to install java on RHEL image on EC2 4 13
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…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
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.

863 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now