Java tutorial
//package com.java2s; import javax.swing.JFrame; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element GetCustomer(JFrame mainFrame, long lookupValue, Document CustomerDoc) { Element Customer = null; Element Root = CustomerDoc.getDocumentElement(); if (Root.hasChildNodes()) { NodeList Customers = Root.getChildNodes(); for (int i = 0; i < Customers.getLength(); i++) { if (Customers.item(i).getNodeName() == "#text") continue; Element Current = (Element) Customers.item(i); if (lookupValue == Integer.parseInt(Current.getAttribute("Id"))) { Customer = Current; } } } return Customer; } }