I'm looking for help to get an XML to an arraylist.
here is the XML :
<campagne>
<sms><texte>
Vente a Drouot
</texte>
<list>
<id> 1 </id>
<nom> TOTO </nom>
<id> 2 </id>
<nom> TATA </nom>
<id> 3 </id>
<nom> Mr.Gerard </nom>
</list>
</sms>
</campagne>
I want to have TOTO,TATA,Mr.Gerard to a StringArray[] exactly like if I put manually : String[] Customers = {"TOTO","TATA","Mr.Gerard"}
for now my XMlPullParser (I have written " ArrayList clientslist = null; " before and I want to put the difference name in this Array ) :
public void parseXMLAndStoreIt(XmlPullParser myParser) {
int event;
String text = null;
ArrayList<Client> clientslist = null;
try {
event = myParser.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
String name = myParser.getName();
switch (event) {
case XmlPullParser.START_TAG:
break;
case XmlPullParser.TEXT:
text = myParser.getText();
break;
case XmlPullParser.END_TAG:
if (name.equals("texte"))
message = text.trim();
else if (name.equals("nom"))
clientslist = text.trim(); // error is here
else
break;
}
event = myParser.next();
}
parsingComplete = false;
} catch (Exception e) {
e.printStackTrace();
}
}
With this code I have Mr.Gerard ONLY...