if (name.equalsIgnoreCase(parent.getLocalName()))
String parentName = parent.getLocalName(); if (parentName == null) { parentName = parent.getNodeName(); } if (name.equalsIgnoreCase(parentName))
  protected Node getParentElement(String name)  {    for (Node parent = getParentNode(); parent != null;         parent = parent.getParentNode())      {        if (name.equalsIgnoreCase(parent.getLocalName()))          {            return parent;          }      }    return null;  }