Node node;
Element next;
Account account;
NodeList ul;
// String lastId;
Group group;
for (int i = 0; i < nl.getLength(); i++) {
if (nl.item(i).getNodeType() != Node.ELEMENT_NODE)
{continue;}
next = (Element) nl.item(i);
if ("users".equals(next.getTagName())) {
// lastId = next.getAttribute("last-id");
// try {
// nextUserId = Integer.parseInt(lastId);
// } catch (NumberFormatException e) {
// }
ul = next.getChildNodes();
for (int j = 0; j < ul.getLength(); j++) {
node = ul.item(j);
if (node.getNodeType() == Node.ELEMENT_NODE && "user".equals(node.getLocalName())) {
account = createAccount(major, minor, (Element) node);
if (sm.hasAccount(account.getName())) {
sm.updateAccount(account);
} else {
sm.addAccount(account);
}
}
}
} else if ("groups".equals(next.getTagName())) {
// lastId = next.getAttribute("last-id");
// try {
// nextGroupId = Integer.parseInt(lastId);
// } catch (NumberFormatException e) {
// }
ul = next.getChildNodes();
for (int j = 0; j < ul.getLength(); j++) {
node = ul.item(j);
if (node.getNodeType() == Node.ELEMENT_NODE && "group".equals(node.getLocalName())) {
group = createGroup((Element) node);
if (sm.hasGroup(group.getName())) {
sm.updateGroup(group);
} else {
sm.addGroup(group);
}
}