See: Description
| Class | Description |
|---|---|
| Compiler |
Compile DFDL schemas into
ProcessorFactory's or reload saved parsers into DataProcessor's. |
| Daffodil |
API Suitable for Java programmers to use.
|
| DataLocation |
Information related to a location in data
|
| DataProcessor |
Compiled version of a DFDL Schema, used to parse data and get the DFDL infoset
|
| Diagnostic |
Class containing diagnostic information
|
| LocationInSchemaFile |
Information related to locations in DFDL schema files
|
| ParseResult |
Result of calling
DataProcessor.parse(java.nio.channels.ReadableByteChannel, long), containing
the resulting infoset, any diagnostic information, and the final data
location |
| ProcessorFactory |
Factory to create
DataProcessor's, used for parsing data |
| WithDiagnostics |
Abstract class that adds diagnostic information to classes that extend it.
|
| Enum | Description |
|---|---|
| ValidationMode |
Validation modes for validating the resulting infoset against the DFDL schema
|
| Exception | Description |
|---|---|
| InvalidParserException |
This exception will be thrown as a result of attempting to reload a saved parser
that is invalid (not a parser file, corrupt, etc.) or
is not in the GZIP format.
|
Daffodil to
create a Compiler:
Compiler c = Daffodil.compiler();
This can then be used to compiled a DFDL schema, and generate a
ProcessorFactory:
ProcessorFactor pf = c.compile(files);
This can then be used to create a DataProcessor:
DataProcessor dp = pf.onPath("/");
This can then be used to parse data, returning a ParseResult, which contains the
DFDL infoset in the form of a jdom2 document:
ParseResult pr = dp.parse(data);
org.jdom2.Document infoset = pr.result();
The DataProcessor.parse(java.nio.channels.ReadableByteChannel)
method may be called multiple times without the need to create
another data processors. For example:
for (File f : inputFiles) {
ParseResult pr = dp.parse(f);
org.jdom2.Document infoset = pr.result();
}
ProcessorFactory, DataProcessor, or ParseResult. However, rather than
throwing an exception on error (e.g. invalid DFDL schema, parse
error, etc), these classes extend WithDiagnostics, which is used to
determine if an error occured, and any diagnostic information (see
Diagnostic) related to the
step. thus, before contining, one must check WithDiagnostics.isError(). For
example:
ProcessorFactor pf = c.compile(files);
if (pf.isError()) {
java.util.List<Diagnostic> diags = pf.getDiagnostics();
foreach (Diagnostic d : diags) {
System.out.println(d.toString());
}
return -1;
}
DataProcessor:
DataProcessor dp = pf.onPath("/");
dp.save(saveFile);
And to restore a saved DataProcessor:
DataProcessor dp = Daffodil.reload(saveFile);
ParseResult pr = dp.parse(data);