private static Node findNodeWithAttribute(Document doc, String nodeName, String name,
      String value) {
    // Get all nodes with given name
    NodeList nodes = doc.getElementsByTagName(nodeName);
    if (nodes == null) {
      return null;
    }

    // Find and return the first node that has the given attribute
    for (int i = 0; i < nodes.getLength(); i++) {
      Node node = nodes.item(i);
      Node nodeAttr = node.getAttributes().getNamedItem(name);

      if (nodeAttr != null && nodeAttr.getTextContent().equals(value)) {
        return node;
      }
    }

    return null;
  }
Finds the node in the given document with the given name and attribute

@param doc XML document to search for the node
@param nodeName The name of the node to search for
@param name The name of the attribute that the node should contain
@param value The value of the node's given attribute
@return Node with the given name, attribute, and attribute value
geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/ContainerInstall.java