1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
public void recupFilm() throws JDOMException, IOException{
SAXBuilder sxb=new SAXBuilder();
document=sxb.build(new File("monxml.xml"));
racine =document.getRootElement();
List<Element> list= racine.getChildren("movie");
Iterator i =list.iterator();
while(i.hasNext()){
Element courant =(Element) i.next();
List<Element> list2 = courant.getChildren("poster");
if(list2.isEmpty()){
FilmCata film=new FilmCata(courant.getAttribute("code").getIntValue(),
courant.getChild("originalTitle").getText()
);
this.lesFilms.add(film);
}
else{
Element courant2=list2.get(0);
FilmCata film=new FilmCata(courant.getAttribute("code").getIntValue(),
courant.getChild("originalTitle").getText(),
courant2.getAttributeValue("href")
);
this.lesFilms.add(film);
}
}
} |