code: public static String getValue(Document document, String xPath) {
  
          Node node = document.selectSingleNode(xPath);
          if (node != null) {
              // return the value
              return node.getText();
          } else {
              return null;
          }
      }
docs: Returns the value in the given xpath of the given xml file.<p>
  
  @param document the xml document
  @param xPath the xpath to read (should select a single node or attribute)
  
  @return the value in the given xpath of the given xml file, or <code>null</code> if no matching node