aspose file tools*
The moose likes Beginning Java and the fly likes [JAVA] XML reader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "[JAVA] XML reader" Watch "[JAVA] XML reader" New topic

[JAVA] XML reader

Adriano Bellavita
Ranch Hand

Joined: Mar 11, 2010
Posts: 37
Hi to all my friends,

I have a new problem today.

I have to parse a simple XML doc, like this one:

My Java method take an int and a String that represents the attribute "locale".

So, the method getParsing (3, "en_GB") returns "minutes", or getParsing (1, "it_IT") returns secondi.

I have found a complex way to get the value I desire, with 2 for cycles: the code is terrible.

So I want to know if, using DOM or another utility, I can have direct access to my XML file.

Any solution?

Paul Clapham

Joined: Oct 14, 2005
Posts: 18124

Of course. With DOM you always have direct access to the XML document. What code were you using before which didn't have direct access to it?

But "direct access" isn't a technical term in the XML world. So perhaps it means something different to you than what I think it means. We can't see any of your code so that's certainly a possibility.
Adriano Bellavita
Ranch Hand

Joined: Mar 11, 2010
Posts: 37
Something like this:

to retrieve all elements in the XML file posted before.
I agree. Here's the link:
subject: [JAVA] XML reader
Similar Threads
3 Features of Java for Internationalization
Methods return array
Stumped By HashSet
Help in connect four
Updatings in database with JSP,EJB,XSL,XSP on JBoss