We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,254 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to convert a Java Object to XML document on Android

Hi !
I'm devloping a Personal Trainer app on android and I need to remember training results in a history. I decided to remeber this results in a XML file.

WHAT I HAVE: is an User class with results

class User{

String name;
int result1;
int result2;

User(String name, int result1, int result2)
    {
        this.name = name;
        this.reuslt1 = result1;
        this.result1 = result2;
    }
}

WAHAT I NEED: is an XMLEndoer.
Eariler a used this code but it doesnt supports andoid:

XMLEncoder e = new XMLEncoder(
                new BufferedOutputStream(
                    new FileOutputStream("Test.xml")));
            e.writeObject(new User("Tom",10,15));
            e.close();

Please, if you know any classes what i can use to make such an xml file please share. Very helpfull would be also an example how to use it.

Thanks for any help.

2
Contributors
1
Reply
6 Hours
Discussion Span
10 Months Ago
Last Updated
2
Views
hatebin
Light Poster
34 posts since Jul 2011
Reputation Points: 9
Solved Threads: 0
Skill Endorsements: 0

Jackson library is capable of it, see this blog entry

peter_budo
Code tags enforcer
Moderator
15,789 posts since Dec 2004
Reputation Points: 2,867
Solved Threads: 944
Skill Endorsements: 50

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0535 seconds using 2.69MB