code: public static Element getRootElementFromString(String payload)
   throws AlipayApiException {
          if (payload == null || payload.trim().length() < 1) {
              throw new AlipayApiException("XML_PAYLOAD_EMPTY");
          }
  
          byte[] bytes = null;
  
          try {
          	payload = StringUtils.stripNonValidXMLCharacters(payload);
  			String encodeString = getEncoding(payload);
              bytes = payload.getBytes(encodeString);
          } catch (UnsupportedEncodingException e) {
              throw new AlipayApiException("XML_ENCODE_ERROR", e);
          }
  
          InputStream in = new ByteArrayInputStream(bytes);
          return getDocument(in).getDocumentElement();
      }
docs: Gets the root element from the given XML payload.
  
  @param payload the XML payload representing the XML file.
  @return the root element of parsed document
  @throws ApiException problem parsing the XML payload