/**
  * @see
  *     com.percussion.extension.IPSResultDocumentProcessor#processResultDocument(java.lang.Object[],
  *     com.percussion.server.IPSRequestContext, org.w3c.dom.Document)
  */
 public Document processResultDocument(
     Object[] params, IPSRequestContext request, Document resultDoc)
     throws PSParameterMismatchException, PSExtensionProcessingException {
   //      if(log.isTraceEnabled())
   //      {
   //         String idoc = PSXmlDocumentBuilder.toString(resultDoc);
   //         log.trace("result doc is " + idoc);
   //      }
   Document errorDoc = PSXmlDocumentBuilder.createXmlDocument();
   try {
     validateDocs(resultDoc, errorDoc, request, params);
   } catch (Exception ex) {
     log.error("Unexpected Exception " + ex, ex);
     throw new PSExtensionProcessingException(getClass().getName(), ex);
   }
   if (hasErrors(errorDoc)) {
     log.debug("validation errors found");
     return errorDoc;
   }
   log.debug("validation successful");
   return null;
 }