code: private Document stage1(final File file) {
          beginStage(PHASE1_STAGE1_HDR, "1", NUM_PHASES);
          final StringBuilder bldr = new StringBuilder();
  
          stageOutput("Validating " + file);
          long t1 = currentTimeMillis();
  
          final Stage1Output output;
          if (isBELScript(file)) {
              output = p1.stage1BELValidation(file);
          } else {
              output = p1.stage1XBELValidation(file);
          }
  
          if (output.hasValidationErrors()) {
              for (final ValidationError error : output.getValidationErrors()) {
                  stageError(error.getUserFacingMessage());
              }
              return null;
          }
  
          if (output.hasConversionError()) {
              stageError(output.getConversionError().getUserFacingMessage());
              return null;
          }
  
          if (output.getSymbolWarning() != null) {
              stageWarning(output.getSymbolWarning().getUserFacingMessage());
          }
  
          long t2 = currentTimeMillis();
          markTime(bldr, t1, t2);
          markEndStage(bldr);
          stageOutput(bldr.toString());
          return output.getDocument();
      }
docs: Stage one validation of the file, returning the converted document or
  {@code null}.
  
  @param file XBEL file
  @return Document