Attribute (String name, Namespace ns) { if (myAttributes instanceof ImmutableSameTypeAttributeList) { return ((ImmutableSameTypeAttributeList)myAttributes).get(name, ns); } String uri = namespace.getURI(); for (Attribute a : myAttributes) { String oldURI = a.getNamespaceURI(); String oldName = a.getName(); if (oldURI.equals(uri) && oldName.equals(name)) { return a; } } return null; }