code: public static Document parseString(final String input) {
          Document output = null;
          try {
              final DocumentBuilder db = FACTORY.newDocumentBuilder();
              db.setErrorHandler(new ParserErrorHandler());
              output = db.parse(new ByteArrayInputStream(input.getBytes()));
          } catch (final Exception ex) {
              String msg = "Problem parsing the input XML string";
              if (ex instanceof SAXParseException) {
                  msg += " at line #" + ((SAXParseException) ex).getLineNumber();
              }
              LOGGER.error(msg, ex);
          }
  
          return output;
      }
docs: Parse a <code>String</code> containing an XML structure into a DOM tree.
  
  @param input
  The input XML <code>String</code>.
  @return The corresponding DOM tree, or <code>null</code> if the input could not be parsed successfully.