docs: public static void main(final String[] args) throws Exception
      {
          if (args.length == 0)
          {
              System.err.format("Usage: %s <filenames>...%n", SbeTool.class.getName());
              System.exit(-1);
          }
  
          for (final String fileName : args)
          {
              final Ir ir;
              if (fileName.endsWith(".xml"))
              {
                  final String xsdFilename = System.getProperty(SbeTool.VALIDATION_XSD);
                  if (xsdFilename != null)
                  {
                      validateAgainstSchema(fileName, xsdFilename);
                  }
  
                  ir = new IrGenerator().generate(parseSchema(fileName), System.getProperty(TARGET_NAMESPACE));
              }
              else if (fileName.endsWith(".sbeir"))
              {
                  ir = new IrDecoder(fileName).decode();
              }
              else
              {
                  System.err.println("Input file format not supported: " + fileName);
                  System.exit(-1);
                  return;
              }
  
              final String outputDirName = System.getProperty(OUTPUT_DIR, ".");
              if (Boolean.parseBoolean(System.getProperty(GENERATE_STUBS, "true")))
              {
                  final String targetLanguage = System.getProperty(TARGET_LANGUAGE, "Java");
  
                  generate(ir, outputDirName, targetLanguage);
              }
  
              if (Boolean.parseBoolean(System.getProperty(GENERATE_IR, "false")))
              {
                  final File inputFile = new File(fileName);
                  final String inputFilename = inputFile.getName();
                  final int nameEnd = inputFilename.lastIndexOf('.');
                  final String namePart = inputFilename.substring(0, nameEnd);
                  final File fullPath = new File(outputDirName, namePart + ".sbeir");
  
                  try (IrEncoder irEncoder = new IrEncoder(fullPath.getAbsolutePath(), ir))
                  {
                      irEncoder.encode();
                  }
              }
          }
      }