code: public static Node findOrAddChildNode(Document doc, Node parentNode, String childName, String childValue){
                  Node matchingChild = getChildNode(parentNode, childName, childValue);
                  return matchingChild != null ? matchingChild : addChildNode(doc, parentNode, childName, childValue);
          }
docs: Get the matching child node. Create a node if it doens't already exist
  @param parentNode - the parent node
  @param childName - name of child node to match
  @param childValue - value of child node to match, specify null to not match value
  @return the child node