public class Compiler
extends java.lang.Object
ProcessorFactory
's or reload saved parsers into DataProcessor
's.
Do not use the Compiler constructor to create a Compiler. Instead, use Daffodil.compiler()
.
Constructor and Description |
---|
Compiler(org.apache.daffodil.core.compiler.Compiler sCompiler) |
Modifier and Type | Method and Description |
---|---|
ProcessorFactory |
compileFile(java.io.File schemaFile)
Compile DFDL schema file into a
ProcessorFactory |
ProcessorFactory |
compileFile(java.io.File schemaFile,
java.lang.String rootName,
java.lang.String rootNamespace)
Compile DFDL schema file into a
ProcessorFactory |
ProcessorFactory |
compileResource(java.lang.String name)
Compile DFDL resource name into a
ProcessorFactory |
ProcessorFactory |
compileResource(java.lang.String name,
java.lang.String rootName,
java.lang.String rootNamespace)
Compile DFDL resource name into a
ProcessorFactory |
ProcessorFactory |
compileSource(java.net.URI uri)
Compile DFDL schema source into a
ProcessorFactory |
ProcessorFactory |
compileSource(java.net.URI uri,
java.lang.String rootName,
java.lang.String rootNamespace)
Compile DFDL schema source into a
ProcessorFactory |
DataProcessor |
reload(java.io.File savedParser)
Reload a saved parser from a file
|
DataProcessor |
reload(java.nio.channels.ReadableByteChannel savedParser)
Reload a saved parser from a
ReadableByteChannel |
Compiler |
withTunable(java.lang.String tunable,
java.lang.String value)
Create a new Compiler instance having a specific Daffodil tunable parameter value.
|
Compiler |
withTunables(java.util.AbstractMap<java.lang.String,java.lang.String> tunables)
Create a new Compiler instance having specific Daffodil tunable parameter values.
|
public ProcessorFactory compileFile(java.io.File schemaFile) throws java.io.IOException
ProcessorFactory
To allow jar-file packaging, (where schema files might be part of a jar),
it is recommended to use compileSource(java.net.URI)
instead.
schemaFile
- DFDL schema file used to create a ProcessorFactory
.ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the schemaFilepublic ProcessorFactory compileFile(java.io.File schemaFile, java.lang.String rootName, java.lang.String rootNamespace) throws java.io.IOException
ProcessorFactory
To allow jar-file packaging, (where schema files might be part of a jar),
it is recommended to use compileSource(java.net.URI)
instead.
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.*ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the schemaFilepublic ProcessorFactory compileResource(java.lang.String name) throws java.io.IOException
ProcessorFactory
name
- Resource name of a DFDL schema used to create a ProcessorFactory
.ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the urijava.io.FileNotFoundException
- if the resource could not be foundpublic ProcessorFactory compileResource(java.lang.String name, java.lang.String rootName, java.lang.String rootNamespace) throws java.io.IOException, java.io.FileNotFoundException
ProcessorFactory
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.ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the urijava.io.FileNotFoundException
- if the resource could not be foundpublic ProcessorFactory compileSource(java.net.URI uri) throws java.io.IOException
ProcessorFactory
uri
- URI of DFDL schema file used to create a ProcessorFactory
.ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the uripublic ProcessorFactory compileSource(java.net.URI uri, java.lang.String rootName, java.lang.String rootNamespace) throws java.io.IOException
ProcessorFactory
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.ProcessorFactory
used to create DataProcessor
(s). Must check WithDiagnostics.isError()
before using it.java.io.IOException
- if an I/O error occurs while reading the uripublic DataProcessor reload(java.io.File savedParser) throws InvalidParserException
To allow jar-file packaging, (where the savedParser might be part of a jar),
it is recommended to use the other version of reload(java.nio.channels.ReadableByteChannel)
where the argument is
a ReadableByteChannel
for a saved parser.
savedParser
- file of a saved parser, created with DataProcessor.save(java.nio.channels.WritableByteChannel)
DataProcessor
used to parse data. Must check WithDiagnostics.isError()
before using it.
InvalidParserException
- if the file is not a valid saved parser.public DataProcessor reload(java.nio.channels.ReadableByteChannel savedParser) throws InvalidParserException
ReadableByteChannel
savedParser
- ReadableByteChannel
of a saved parser, created with DataProcessor.save(java.nio.channels.WritableByteChannel)
DataProcessor
used to parse data. Must check WithDiagnostics.isError()
before using it.
InvalidParserException
- if the file is not a valid saved parser.public Compiler withTunable(java.lang.String tunable, java.lang.String value)
tunable
- name of the tunable parametervalue
- value of the tunable parameterpublic Compiler withTunables(java.util.AbstractMap<java.lang.String,java.lang.String> tunables)
tunables
- a map of key/value pairs, where the key is the tunable name and the value is the value it will get.