Interface DataProcessor

All Superinterfaces:
Serializable, WithDiagnostics

public interface DataProcessor extends WithDiagnostics, Serializable
Compiled version of a DFDL Schema, used to parse data and get the DFDL infoset
  • Method Details

    • withDebugger

      DataProcessor withDebugger(Debugger dbg)
      Obtain a new DataProcessor with a specified debugger or null to disable debugging.
      Parameters:
      dbg - debugger to use or null to disable debugging
      Returns:
      a new DataProcessor with a specified debugger.
    • withValidation

      Obtain a new DataProcessor with validation that does not require configuration.
      Parameters:
      kind - Kind of validation to use. Can be a custom validator name available via the ValidatorFactory SPI or one of the built-in validators ("xerces", "daffodil", "off", "schematron")
      Returns:
      a new DataProcessor with a specified validator.
      Throws:
      ValidatorNotRegisteredException - if the validator cannot be found
      ValidatorInitializationException - if initializing the validator fails
    • withValidation

      Obtain a new DataProcessor with validation using a URI for configuration.
      Parameters:
      kind - Kind of validation to use. Can be a custom validator name available via the ValidatorFactory SPI or one of the built-in validators ("xerces", "daffodil", "off", "schematron")
      config - URL to use for validation configuration. If the URL path ends with .conf or .properties it is treated as a java.util.Properties file that is loaded and provided to the validator. Otherwise, the URL is provided as a single property to the validator. Can be null if a URL is not known or the validator does not need additional configuration--this could cause an exception if a validator requires properties.
      Returns:
      a new DataProcessor with a specified validator.
      Throws:
      ValidatorNotRegisteredException - if the validator cannot be found
      ValidatorInitializationException - if initializing the validator fails
    • withExternalVariables

      DataProcessor withExternalVariables(File extVars) throws ExternalVariableException
      Obtain a new DataProcessor with external variables read from a Daffodil configuration file
      Parameters:
      extVars - file to read DFDL variables from.
      Returns:
      a new DataProcessor with external variables read from a Daffodil configuration file
      Throws:
      ExternalVariableException - if an error occurs while setting an external variable
      See Also:
    • withExternalVariables

      DataProcessor withExternalVariables(Map<String,String> extVars) throws ExternalVariableException
      Obtain a new DataProcessor with multiple DFDL variables set.
      Parameters:
      extVars - a map 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. If not preceded by anything, then Daffodil will figure out the namespace.
      Returns:
      a new DataProcessor with multiple DFDL variables set.
      Throws:
      ExternalVariableException - if an error occurs while setting an external variable
    • save

      void save(WritableByteChannel output)
      Save the DataProcessor

      The resulting output can be reloaded by Compiler.reload(savedParser:java\.nio\.channels\.ReadableByteChannel)* Compiler.reload. Note that any changes due to withValidator, withDebugger, and any compile diagnostics are not saved

      Parameters:
      output - the byte channel to write the DataProcessor to. Note that external variable settings are not saved.
    • walkMetadata

      void walkMetadata(MetadataHandler handler)
      Walks the handler over the runtime metadata structures
      Parameters:
      handler - - the handler is called-back during the walk as each metadata structure is encountered.
    • newXMLReaderInstance

      DaffodilParseXMLReader newXMLReaderInstance()
      Returns:
      a new DaffodilParseXMLReader from the current DataProcessor for SAX Parsing.
    • newContentHandlerInstance

      DaffodilUnparseContentHandler newContentHandlerInstance(WritableByteChannel output)
      Parameters:
      output - Writable Byte Channel for unparsing
      Returns:
      a new DaffodilUnparseContentHandler from the current DataProcessor for SAX Unparsing.
    • parse

      Parse input data from an InputSourceDataInputStream and output the infoset to an InfosetOutputter
      Parameters:
      input - data to be parsed
      output - the InfosetOutputter that will be used to output the infoset
      Returns:
      an object which contains the result, and/or diagnostic information.
    • unparse

      Unparse (i.e serializes) data from an InfosetInputter to the output
      Parameters:
      input - the infoset inputter to use for unparsing
      output - the byte channel to write the data to
      Returns:
      an object with contains diagnostic information