aspose file tools*
The moose likes XML and Related Technologies and the fly likes questions on XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "questions on XML" Watch "questions on XML" New topic
Author

questions on XML

kira yamato
Greenhorn

Joined: Mar 24, 2005
Posts: 7
So sorry..i was a newbie in doing XML right now.

i have an xml file which is like this

<?xml version='1.0' encoding='UTF-8'?>

<navigation>
<links>http:www.yahoo.com.sg</links>
<links>http:www.yahoo.com.sg 1</links>
<links>http:www.yahoo.com.sg 2</links>
<links>http:www.yahoo.com.sg 3</links>
<links>http:www.yahoo.com.sg 4</links>
</navigation>

my question is how do i get all the values encapsulated in between <link></links> tag for my j2ee project ?
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
You could try using Jakarta Commons Digester.


James Carman, President<br />Carman Consulting, Inc.
kira yamato
Greenhorn

Joined: Mar 24, 2005
Posts: 7
oh..ok..i tried common digester...
but i'm not sure how it works..when i looked at the user guide..it seems confusing

so..is there anyone who can explain an example on how to do it ??of course in layman terms..

for example this xml file

<?xml version='1.0' encoding='UTF-8'?>

<navigation>
<links>http:www.yahoo.com.sg</links>
<links>http:www.yahoo.com.sg 1</links>
<links>http:www.yahoo.com.sg 2</links>
<links>http:www.yahoo.com.sg 3</links>
<links>http:www.yahoo.com.sg 4</links>
</navigation>

regarding read the values in between <links></links>
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040
Well, the short answer is -

You need to parse the XML file. Using either the SAX or the DOM API's.
Once you parse the file and get the document object in DOM or implement the Start, Charecters and End element messages in SAX, you will be able to acheive what you are looking for.

A starting point would be some tutorial and example code.

- m


Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
wood burning stoves
 
subject: questions on XML