passwordElem.setText(info.getPassword());
elem.addContent(passwordElem);
}
}
public SshInfo readSshInfo(Element elem) throws IOException {
SshInfo info = new SshInfo();
List children = elem.getChildren();
Element child;
for (int i=0; i<children.size(); i++) {
child = (Element)children.get(i);
String name = child.getName();
if (name.equals("system"))
info.setSystem(child.getText());
else if (name.equals("user"))
info.setUserName(child.getText());
else if (name.equals("password"))
info.setPassword(child.getText());
}
//validate:
if (info.getSystem() == null)
throw new MissingElementException("system", elem);
return info;
}