package test.appProfConverter; import org.w3c.dom.Element; public class Memory { public Memory(Element e) throws Exception { LoadElement(e); } private void LoadElement(Element e) throws Exception { if (!e.getTagName().equals("Memory")) { throw new Exception("Invalid element tag."); } Capacity = Integer.parseInt(e.getElementsByTagName("Capacity").item(0) .getChildNodes().item(0).getNodeValue().trim()); } public int Capacity; public String ToString() { String str = ""; str += "Memory:\n"; str += " Capacity: " + Integer.toString(Capacity) + "\n"; return str; } }