POLITECHNIKA RZESZOWSKA - Wydział Elektrotechniki l Informatyki
import j avax.xm) import org.w3c.ć import java.io.*
public class AddressBookList {
public static void main(String[] args) { try {
DocumentBuilderFactory factory - DocumentBuilderFactory.newlnstance()/ DocumentBuilder builder = factory.newDocumentBuilder();
Document document - builder.parse(new File("addressbook.xml"));
Element root - document.gotDocumentElement();
System.out.println(”root Element Name: " + root.getTagName());
Element titleElement -
(Element)root.getElementsByTagHame("title").itam(O); String title = titleElement.getFirstChildO.getNodeValue();
System.out.println("Title: " + title);
U
Wykład.
Copyright © 2012 Jan PROKOP