code: public boolean validate(final ValidationMethod method, final Document doc, final String fileName, final byte[] data,
              final String entities, final Map<String, byte[]> additionalFiles) {
          if (doc == null || doc.getDocumentElement() == null) {
              return false;
          } else {
              final String xml;
              if (doc.getXmlEncoding() == null) {
                  xml = XMLUtilities.convertDocumentToString(doc, "UTF-8");
              } else {
                  xml = XMLUtilities.convertDocumentToString(doc);
              }
  
              return validate(method, xml, fileName, data, entities, doc.getDocumentElement().getNodeName(), additionalFiles);
          }
      }
docs: Validates some piece of XML, by firstly converting it to a string to ensure that it is valid.
  
  @param method          The validation method to use during validation.
  @param doc             The XML DOM Document to be validated.
  @param fileName        The filename of the DTD/Schema data.
  @param data            The DTD/Schema data to be used to validate against.
  @param entities        The entity data to be used to validate against.
  @param additionalFiles Any additional files that are needed during the validation.
  @return True if the XML is valid, otherwise false.