File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes convert XML to JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "convert XML to JAVA" Watch "convert XML to JAVA" New topic

convert XML to JAVA

PrashantKc Kumar

Joined: Jan 11, 2012
Posts: 1
I have following xml :

<AllEnvList name="env1">
<AllEnvList name="env2">
<AllEnvList name="env3">

I need to convert this xml into List<String> & last three in HashMap<String, List<String>> [ here Key String will the attribute name value ]. I tried some method but not able to get the value XXX from <ListEnv> XXX </ListEnv>
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 41065
Apache Commons Digester can help with this if you only need the XML->Java direction. Or write a SAX parser that creates those objects.

If you need Java -> XML as well, JAXB might be the way to go.

Ping & DNS - my free Android networking tools app
I agree. Here's the link:
subject: convert XML to JAVA
Similar Threads
different target calling different properties
Help with Combo box and action listener
problem using nested sysproperty in testng task
Managing Properties files
Extending MessageResources in Struts