Parse XML into ArrayList

Put your problem here if it does not fit any of the other categories.

Parse XML into ArrayList

Postby burakkilic » Sat Oct 17, 2009 12:13 pm

Hi. I am getting a xml string response. And I want to parse that xml string. For example, to ArrayList<Person> object. Lets say Person object includes String name. xml is
<Person>
<Name>asjdhajshd</Name>
</Person>
<Person>
<Name>93dasdasf</Name>
</Person>

So when I parse it, I will have the list of the people. Any idea?
burakkilic
Developer
Developer
 
Posts: 37
Joined: Thu Oct 01, 2009 10:24 am

Top

Postby padde » Sat Oct 17, 2009 1:58 pm

have you ever heard of the search function? :evil:
padde
Master Developer
Master Developer
 
Posts: 443
Joined: Wed Apr 08, 2009 4:52 pm

Postby burakkilic » Sat Oct 17, 2009 2:14 pm

no, but when I was looking for it, I saw the Handler.
burakkilic
Developer
Developer
 
Posts: 37
Joined: Thu Oct 01, 2009 10:24 am

Re: Parse XML into ArrayList

Postby sudheer1437 » Mon Oct 19, 2009 5:26 pm

burakkilic wrote:Hi. I am getting a xml string response. And I want to parse that xml string. For example, to ArrayList<Person> object. Lets say Person object includes String name. xml is
<Person>
<Name>asjdhajshd</Name>
</Person>
<Person>
<Name>93dasdasf</Name>
</Person>

So when I parse it, I will have the list of the people. Any idea?



Create a Person class which has setName and getName methods.
in ur parser class...
create a ArrayList<Person>

create a new object for every new Tag.
set the name and push that object into the arraylist..

later using Listiterator u can retrieve the objects and by getName method u can get individual names..

Hope i m clear and dis is wad ur looking for....
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Re: Parse XML into ArrayList

Postby android2 » Mon Oct 26, 2009 3:43 pm

hello you managed to do the parsing and put it in an array list???
sudheer1437 wrote:
burakkilic wrote:Hi. I am getting a xml string response. And I want to parse that xml string. For example, to ArrayList<Person> object. Lets say Person object includes String name. xml is
<Person>
<Name>asjdhajshd</Name>
</Person>
<Person>
<Name>93dasdasf</Name>
</Person>

So when I parse it, I will have the list of the people. Any idea?



Create a Person class which has setName and getName methods.
in ur parser class...
create a ArrayList<Person>

create a new object for every new Tag.
set the name and push that object into the arraylist..

later using Listiterator u can retrieve the objects and by getName method u can get individual names..

Hope i m clear and dis is wad ur looking for....
android2
Developer
Developer
 
Posts: 48
Joined: Sun Oct 04, 2009 8:34 pm

Re: Parse XML into ArrayList

Postby hPushpa18 » Fri Nov 06, 2009 6:00 am

Hi,

Are u able to extract the persons names ?If yes can u plz send your source code(project) to me.I am in urgent need.Even i want to parse xml.Its really urgent can u plz send me now

Thanks and regards,
Pushpa
hPushpa18
Junior Developer
Junior Developer
 
Posts: 14
Joined: Mon Nov 02, 2009 11:08 am
Location: Bangalore

Top

Postby sudheer1437 » Fri Nov 06, 2009 10:37 am

Hi pushpa,
check ur private messages...
sudheer1437
Experienced Developer
Experienced Developer
 
Posts: 79
Joined: Sat Aug 08, 2009 7:42 am
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 26 guests