Q:

ArrayList android

I use Jsoup to get the tag value of soap content. for example:
Document doc = Jsoup.parse(getxml);
Elements element1 = doc.select("codeSession");
code_session = element1.text();

where getxml = </soap><root><one></one><two></two><three></three></root><root><one></one><two></two><three></three></root></soap>
I want to store each root element detail into an arraylist how can i achieve this. am on this for two hours now.
public ArrayList<Post> PostList = new ArrayList<Post>();

A:

This code snippet should do it.
    String html = "<?xml version=\"1.0\" encoding=\"UTF-8\"></soap><root><one></one><two></two><three></three></root><root><one></one><two></two><three></three></root></soap>";
    Document doc = Jsoup.parse(html, "", Parser.xmlParser());
    List<Element> list = new ArrayList<Element>(); 
    for (Element e : doc.select("root")) 
    {
        System.out.println(e);
        list.add(e);
    }

Output
<root>
<one></one>
<two></two>
<three></three>
</root>
<root>
<one></one>
 <two></two>
 <three></three>
</root>

