POLITECHNIKA RZESZOWSKA - Wydział Elektrotechniki I Informatyki
System.out.println("****» Elementy potomne *****");
NodeLiat list - root.getElementsByTagName("person")/ for (int i=0; i < list.getLength() ; i++) {
Element element - (Element)list.item(i);
String id = element.getAttribute("id");.
NodeList nameList = element.getElementsByTagName("name"); Element nameElement = (Element)nameList.item(O);
String name = nameElement.getFicstChild().getNodeValue(); NodeList emailList = element.getElementsByTagName("email"); Element emailElement = (Element)emailList.item(O);
String email = emailElement.getFirstChildO .getNodeValue() r System.out.println("ID: " + id + “ " +
"Name: " + name + " " +
"Email: " + email);
Copyright © 2012 Jan PROKOP