// read data from the starting XML file (people.xml) // and put them into a PeopleStore instance public static void initializeDB() { HealthProfileReader HP = new HealthProfileReader(); List<String> peopleInfo = null; try { peopleInfo = HP.readallinfo(); } catch (XPathExpressionException e) { e.printStackTrace(); } // "saves" all the retrieved information about people for (int i = 0; i < peopleInfo.size(); i += 8) { Person pallino = new Person( peopleInfo.get(i + 0), // id peopleInfo.get(i + 1), // firstname peopleInfo.get(i + 2), // lastname peopleInfo.get(i + 3)); // birthdate pallino.setHProfile( new HealthProfile( peopleInfo.get(i + 4), // last update Double.parseDouble(peopleInfo.get(i + 5)), // weight Double.parseDouble(peopleInfo.get(i + 6)))); // height // bmi will be calculated in HealthProfile people.getData().add(pallino); } }