code: public static void setDirectTextContent(final Node elementToChange, final String asString) {
          assert elementToChange.getNodeType() != Node.DOCUMENT_NODE;
          if (Node.ATTRIBUTE_NODE == elementToChange.getNodeType()) {
              elementToChange.setTextContent(asString);
              return;
          }
          List<Node> nodes = new LinkedList<Node>();
          List<Node> nodes2 = new LinkedList<Node>();
          for (Node n : nodeListToIterator(elementToChange.getChildNodes())) {
              if (Node.TEXT_NODE == n.getNodeType()) {
                  continue;
              }
              nodes.add(n);
          }
          if ((asString != null) && (!asString.isEmpty())) {
              elementToChange.setTextContent(asString);
              for (Node n : nodeListToIterator(elementToChange.getChildNodes())) {
                  if (Node.TEXT_NODE != n.getNodeType()) {
                      continue;
                  }
                  nodes.add(n);
              }
          }
          removeAllChildren(elementToChange);
          for (Node n : nodes) {
              elementToChange.appendChild(n);
          }
          for (Node n : nodes2) {
              elementToChange.appendChild(n);
          }
  
      }
docs: Set text content of given element without removing existing child nodes. Text nodes are added
  after child element nodes always.
  
  @param elementToChange
  @param asString