int i = 0;
while ((i < attributes.getLength())
&& (idTypedAttribute == null)) {
Node attr = attributes.item(i);
String attrName = attr.getNodeName();
CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) elementDecl
.getAttributes().getNamedItem(attrName);
if (attrDecl != null) {
if ((attrDecl.getAttrType() != null)
&& (CMDataType.ID.equals(attrDecl
.getAttrType()
.getDataTypeName()))) {
idTypedAttribute = attr;
} else if ((attrDecl.getUsage() == CMAttributeDeclaration.REQUIRED)
&& (requiredAttribute == null)) {
// as a backup, keep tabs on
// any required
// attributes
requiredAttribute = attr;