private static String checkNamespaceCollision(Namespace namespace, List<?> list, final int ignoreAtt) {
    if (list == null) {
      return null;
    }

    String reason = null;
    final Iterator<?> i = list.iterator();
    int cnt = -1;
    while ((reason == null) && i.hasNext()) {
      final Object obj = i.next();
      cnt++;
      if (obj instanceof Attribute) {
        if (cnt == ignoreAtt) {
          continue;
        }
        reason = checkNamespaceCollision(namespace, (Attribute)obj);
      }
      else if (obj instanceof Element) {
        reason = checkNamespaceCollision(namespace, (Element)obj);
      }
      else if (obj instanceof Namespace) {
        reason = checkNamespaceCollision(namespace, (Namespace)obj);
        if (reason != null) {
          reason += " with an additional namespace declared" +
                    " by the element";
        }
      }
    }
    return reason;
  }
private static String checkNamespaceCollision(Namespace namespace, List<?> list, final int ignoreAtt)