POLITECHNIK* RZESZOWSKA - Wydział Elektrotechniki I Informatyki
import org.w3c.dom.*; import javax.xml.paraera.*; import java.io.*; public class DOMSimpleDemo (
public static void main(StringlJ arga) throwa Exception ( try (
DocumentBuilderFactory factory -
DocumentBuilderFactory.newInatanceO ; DocumentBuilder builder - factory.newDocumentBuilder();
Document document - builder .parse (new File (“DOMSimpleDemo.xml”)) / traceNodes(document);
) catch (Exception e) ( e.printStackTraceO t
)
atatic private void traceNodes(Node node) {
Node child - node.getFiratChildl); while (child !- nuli) ( printNode (child); traceNodes(child); child - child.getNextSibling();
Copyright © 2012 Jan PROKOP