Interface Compiler


public interface Compiler
Compile DFDL schemas into ProcessorFactory's or reload saved parsers into DataProcessor's.

Use Daffodil#compiler() to get a compiler instance.

  • Method Details

    • compileFile

      default ProcessorFactory compileFile(File schemaFile)
      Compile DFDL schema file into a ProcessorFactory

      To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use Compiler.compileSource instead.

      Parameters:
      schemaFile - DFDL schema file used to create a ProcessorFactory.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileFile

      default ProcessorFactory compileFile(File schemaFile, String rootName)
      Compile DFDL schema file into a ProcessorFactory

      To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use Compiler.compileSource instead.

      Parameters:
      schemaFile - DFDL schema file used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileFile

      ProcessorFactory compileFile(File schemaFile, String rootName, String rootNamespace)
      Compile DFDL schema file into a ProcessorFactory

      To allow jar-file packaging, (where schema files might be part of a jar), it is recommended to use Compiler.compileSource instead.

      Parameters:
      schemaFile - DFDL schema file used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      rootNamespace - String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.*
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileSource

      default ProcessorFactory compileSource(URI uri)
      Compile DFDL schema source into a ProcessorFactory
      Parameters:
      uri - URI of DFDL schema file used to create a ProcessorFactory.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileSource

      default ProcessorFactory compileSource(URI uri, String rootName)
      Compile DFDL schema source into a ProcessorFactory
      Parameters:
      uri - URI of DFDL schema file used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileSource

      ProcessorFactory compileSource(URI uri, String rootName, String rootNamespace)
      Compile DFDL schema source into a ProcessorFactory
      Parameters:
      uri - URI of DFDL schema file used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      rootNamespace - String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
    • compileResource

      default ProcessorFactory compileResource(String name) throws IOException
      Compile DFDL resource name into a ProcessorFactory
      Parameters:
      name - Resource name of a DFDL schema used to create a ProcessorFactory.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
      Throws:
      IOException - if resource cannot be found
    • compileResource

      default ProcessorFactory compileResource(String name, String rootName) throws IOException
      Compile DFDL resource name into a ProcessorFactory
      Parameters:
      name - Resource name of a DFDL schema used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
      Throws:
      IOException - if resource cannot be found
    • compileResource

      ProcessorFactory compileResource(String name, String rootName, String rootNamespace) throws IOException
      Compile DFDL resource name into a ProcessorFactory
      Parameters:
      name - Resource name of a DFDL schema used to create a ProcessorFactory.
      rootName - name of root element, or null to choose automatically from first element of schema.
      rootNamespace - String of namespace of the root element, or null to infer automatically when unambiguous. Pass "" (empty string) for No Namespace.
      Returns:
      ProcessorFactory used to create DataProcessor(s). Must check ProcessorFactory.isError before using it.
      Throws:
      IOException - if resource cannot be found
    • reload

      DataProcessor reload(File savedParser) throws InvalidParserException
      Reload a saved parser from a file

      To allow jar-file packaging, (where the savedParser might be part of a jar), it is recommended to use the other version of Compiler.reload(savedParser:java\.nio\.channels\.ReadableByteChannel)* Compiler.reload where the argument is a java.nio.channels.ReadableByteChannel for a saved parser.

      Parameters:
      savedParser - file of a saved parser, created with DataProcessor.save
      Returns:
      DataProcessor used to parse data. Must check DataProcessor.isError before using it.
      Throws:
      InvalidParserException - if the file is not a valid saved parser.
    • reload

      Reload a saved parser from a java.nio.channels.ReadableByteChannel
      Parameters:
      savedParser - java.nio.channels.ReadableByteChannel of a saved parser, created with DataProcessor.save
      Returns:
      DataProcessor used to parse data. Must check DataProcessor.isError before using it.
      Throws:
      InvalidParserException - if the file is not a valid saved parser.
    • withTunable

      Compiler withTunable(String tunable, String value)
      Return a new Compiler with a specific Daffodil tunable parameter
      Parameters:
      tunable - name of the tunable parameter to set.
      value - value of the tunable parameter to set
      Returns:
      new Compiler with a specific Daffodil tunable parameter
      See Also:
    • withTunables

      Compiler withTunables(Map<String,String> tunables)
      Return a new Compiler with multiple tunable parameters
      Parameters:
      tunables - a map of key/value pairs, where the key is the tunable name and the value is the value to set it to
      Returns:
      new Compiler with multiple tunable parameters
      See Also: