code: private static void prepareDocType(final InputStream body,
          final Transformer transformer) throws IOException {
          try {
              final String html = "html";
              final DocumentType doctype = RsPrettyXml.getDocType(body);
              if (null != doctype) {
                  if (null == doctype.getSystemId()
                      && null == doctype.getPublicId()
                      // @checkstyle MultipleStringLiteralsCheck (3 line)
                      && html.equalsIgnoreCase(doctype.getName())) {
                      transformer.setOutputProperty(OutputKeys.METHOD, html);
                      transformer.setOutputProperty(OutputKeys.VERSION, "5.0");
                      return;
                  }
                  if (null != doctype.getSystemId()) {
                      transformer.setOutputProperty(
                          OutputKeys.DOCTYPE_SYSTEM,
                          doctype.getSystemId()
                      );
                  }
                  if (null != doctype.getPublicId()) {
                      transformer.setOutputProperty(
                          OutputKeys.DOCTYPE_PUBLIC,
                          doctype.getPublicId()
                      );
                  }
              }
          } finally {
              body.reset();
          }
      }
docs: Parses body to get DOCTYPE and configure Transformer
  with proper method, public id and system id.
  @param body The body to be parsed.
  @param transformer Transformer to configure with proper properties.
  @throws IOException if something goes wrong.