private void load() { File file = new File(filename); if (file.exists()) { try { Document doc = XmlUtil.getDocument(file); Element root = doc.getDocumentElement(); Node child = root.getFirstChild(); while (child != null) { if (child.getNodeType() == Node.ELEMENT_NODE) { Profile p = new Profile((Element) child); table.put(p.name, p); } child = child.getNextSibling(); } } catch (Exception ignore) { } } }
public void add(Profile profile) { table.put(profile.name, profile); save(); }