code: public static String selectSingleNodeValue(Node node, String xpathQuery) {
          Node resultNode = node.selectSingleNode(xpathQuery);
          if (resultNode != null) {
              return resultNode.getText();
          } else {
              return null;
          }
      }
docs: Executes the specified XPath query as a single node query, returning the text value of the resulting single node.