System.out.println("Generating IDs.");
int count = 0;
for (int i = 0; i < documents.length; i++) {
Element elem = documents[i].getElement();
if (!elem.hasAttribute("id")) {
RandomGUID randomGUID = new RandomGUID();
elem.setAttribute("id", randomGUID.toString());
count++;
}
}
if (count > 0) {
System.out.println("Generated " + count + " new ID(s).");