private ArrayList<ToDoItem> getItems(String cat) {
        List list = data.getChildren();
        ArrayList<ToDoItem> listOfItems = new ArrayList<>();
        Iterator iter = list.iterator();
        while (iter.hasNext()) {
            Element e = (Element) iter.next();
            if (cat.equals("") || cat.equals(e.getAttributeValue("category"))) {
                int number = Integer.parseInt(e.getName().substring(1));
                Priority prio = null;
                switch (e.getAttributeValue("priority").toUpperCase()) {
                    case "LOW":
                        prio = Priority.LOW;
                        break;
                    case "MEDIUM":
                        prio = Priority.MEDIUM;
                        break;
                    case "HIGH":
                        prio = Priority.HIGH;
                        break;
                }
                int year = Integer.parseInt(e.getAttributeValue("year"));
                int month = Integer.parseInt(e.getAttributeValue("month"));
                int day = Integer.parseInt(e.getAttributeValue("day"));
                int hour = Integer.parseInt(e.getAttributeValue("hour"));
                int minute = Integer.parseInt(e.getAttributeValue("minute"));
                GregorianCalendar cal = new GregorianCalendar(year, month, day,
                        hour, minute);
                ToDoItem item = new ToDoItem(number, e.getAttributeValue("title"),
                        e.getAttributeValue("description"),
                        e.getAttributeValue("category"), prio, cal);
                if (e.getAttributeValue("done").equals("true")) {
                    item.setDone(true);
                } else {
                    item.setDone(false);
                }
                listOfItems.add(item);
            }
        }
        return listOfItems;
    }