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() |
Modifier and Type | Method and Description |
---|---|
ProcessorFactory |
compileFile(java.io.File schemaFile)
Compile DFDL schema file into a
ProcessorFactory |
ProcessorFactory |
compileSource(java.net.URI uri)
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 |
void |
setDistinguishedRootNode(java.lang.String name,
java.lang.String namespace)
Specify a global element to be the root of DFDL Schema to start parsing
|
void |
setExternalDFDLVariable(java.lang.String name,
java.lang.String namespace,
java.lang.String value)
Set the value of a DFDL variable
|
void |
setExternalDFDLVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVarsMap)
Set the value of multiple DFDL variables
|
void |
setExternalDFDLVariables(java.io.File extVarsFile)
Read external variables from a Daffodil configuration file
|
void |
setTunable(java.lang.String tunable,
java.lang.String value)
Set a Daffodil tunable parameter
|
void |
setTunables(java.util.AbstractMap<java.lang.String,java.lang.String> tunables)
Set the value of multiple tunable parameters
|
void |
setValidateDFDLSchemas(boolean value)
Enable/disable DFDL validation of resulting infoset with the DFDL schema
|
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
public 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
public 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 void setDistinguishedRootNode(java.lang.String name, java.lang.String namespace)
name
- name of the root nodenamespace
- namespace of the root node. Set to empty string to specify
no namespace. Set to to NULL to figure out the namespace.public void setExternalDFDLVariable(java.lang.String name, java.lang.String namespace, java.lang.String value)
name
- name of the variablenamespace
- namespace of the variable. Set to empty string to specify
no namespace. Set to to NULL to figure out the namespace.value
- value to so the variable topublic void setExternalDFDLVariables(java.util.AbstractMap<java.lang.String,java.lang.String> extVarsMap)
extVarsMap
- a may of key/value pairs, where the key is the variable
name, and the value is the value of the variable. The key
may be preceded by a string of the form "{namespace}" to
define a namespace for the variable. If preceded with "{}",
then no namespace is used. With not preceded by "{namespace}",
then Daffodil will figure out the namespace.public void setExternalDFDLVariables(java.io.File extVarsFile)
extVarsFile
- file to read DFDL variables from.public void setValidateDFDLSchemas(boolean value)
value
- true to enable validation, false to disabledpublic void setTunable(java.lang.String tunable, java.lang.String value)
tunable
- name of the tunable parameter to set.value
- value of the tunable parameter to setpublic void setTunables(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 to set it to