I am parsing an XML file through Android Pull Parser technique. First, have a look at the below XML file:
<childs>
<students>
<name> hello </name>
<address> xyz </address>
</stdents>
<students>
<name> abc </name>
<address> def </address>
</stdents>
</childs>
Consider that I’m parsing the above file. Now, my problem is that I want to create a separate array for name and address. So while parsing, I want to store 1st student’s data in name[0] and address[0] and the next student’s data in name[1] and address[1]. In short, array size is extending as more data is parsed.
Is there any way to do so? I mean to create a dynamic extendable array? Or if there is another way to do so then please help me to fight with this problem.
You could use
Vector<String>and then (if you need an array) copy the data to array(s) usingtoArraymethod.Another option: