for (Iterator i = messagesDoc.xpathIterator("/MessageCollection/BugCode"); i.hasNext(); ) { Node node = (Node) i.next();
for (Iterator<Node> i = messagesDoc.xpathIterator("/MessageCollection/BugCode"); i.hasNext(); ) { Node node = i.next();
	public void checkMessages(XMLFile messagesDoc) throws DocumentException {		// Detector elements must all have a class attribute		// and details child element.		for (Iterator i = messagesDoc.xpathIterator("/MessageCollection/Detector"); i.hasNext(); ) {			Node node = (Node) i.next();			messagesDoc.checkAttribute(node, "class");			messagesDoc.checkElement(node, "Details");		}		// BugPattern elements must all have type attribute		// and ShortDescription, LongDescription, and Details		// child elements.		for (Iterator i = messagesDoc.xpathIterator("/MessageCollection/BugPattern"); i.hasNext(); ) {			Node node = (Node) i.next();			messagesDoc.checkAttribute(node, "type");			messagesDoc.checkElement(node, "ShortDescription");			messagesDoc.checkElement(node, "LongDescription");			messagesDoc.checkElement(node, "Details");		}		// BugCode elements must contain abbrev attribute		// and have non-empty text		for (Iterator i = messagesDoc.xpathIterator("/MessageCollection/BugCode"); i.hasNext(); ) {			Node node = (Node) i.next();			messagesDoc.checkAttribute(node, "abbrev");			messagesDoc.checkNonEmptyText(node);		}		// Check that all Detectors are described		Set<String> describedDetectorsSet =			messagesDoc.collectAttributes("/MessageCollection/Detector", "class");		checkDescribed("Bug detectors not described by Detector elements",			messagesDoc, declaredDetectorsSet, describedDetectorsSet);		// Check that all BugCodes are described		Set<String> describedAbbrevsSet =			messagesDoc.collectAttributes("/MessageCollection/BugCode", "abbrev");		checkDescribed("Abbreviations not described by BugCode elements",			messagesDoc, declaredAbbrevsSet, describedAbbrevsSet);	}