1

How can I take items from this xml inside <elem></elem> and use it in RecyclerView? How can I modify my parse to take all things inside this one and what should I do with them? Add it to the ArrayList and then use it in RecyclerView? What is your idea?

<xl>
    <elem>
        <data>2019-03-05 10:20:23</data>
        <id>1</id>
        <points>5</points>
        <cost>54.00</cost>
    </elem>
    <elem>
        <data>2019-03-05 10:50:52</data>
        <id>2</id>
        <points>5</points>
        <cost>50.00</cost>
    </elem>
    <elem>
        <data>2019-03-05 14:58:47</data>
        <id>3</id>
        <points>5</points>
        <cost>50.00</cost>
    </elem>
</xl>

From code like this I can take "Someone to parse" by parser below:

<xl>
    <elem>
          Someone to parse
    </elem>

public String[][] parserXMLArrayTest(Document doc, String name) {
    NodeList dane = doc.getElementsByTagName(name);
    String[][] ret = null;
    for (int i = 0; i < dane.getLength(); i++) {
        Element e = (Element) dane.item(i);
        NodeList node = e.getElementsByTagName("elem");
        ret = new String[node.getLength()][4];
        for (int j = 0; j < node.getLength(); j++) {
        }
    }
    return ret;
}
Nick Bapu
  • 463
  • 1
  • 4
  • 14
Szymon
  • 61
  • 8
  • 1
    check this https://stackoverflow.com/a/53593870/7666442 – AskNilesh May 23 '19 at 07:24
  • You can create an object with all the fields you have in your XML. Then, when you're parsing XML - create this object and add it to some `List` and later use this list for your `RecyclerView`. – Dmitriy Mitiai May 23 '19 at 07:25

0 Answers0