XMLAttribute (String name, String namespace) { for (XMLAttribute attr : attributes) { boolean found = attr.getName().equals(name); if (namespace == null) { found &= (attr.getNamespace() == null); } else { found &= namespace.equals(attr.getNamespace()); } if (found) { return attr; } } return null; }