Sign in to follow this  

Using Java to take in a XML file

Recommended Posts

timsweb    1

Hey,

I was wondering how I could use Java to take in a XML file and put the data in a object? and write to a XML file?

Thanks, Tim

Share this post


Link to post
Share on other sites
kjordan2001    164

For serializing objects, you might want to take a look at XStream: http://xstream.codehaus.org/

If external libraries aren't an option, you can use the built-in java classes for XML parsing:

http://www.mkyong.co...ava-dom-parser/

http://www.mkyong.com/java/how-to-read-xml-file-in-java-sax-parser/

You'll have to do any type conversions for numbers and such for the values inside the XML nodes this way though.

Share this post


Link to post
Share on other sites
timsweb    1

Exactly what I was looking for, thanks kjordan2001

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.