Class CsvConverter

java.lang.Object
org.basex.core.jobs.Job
org.basex.io.parse.csv.CsvConverter
Direct Known Subclasses:
CsvXQueryConverter

public abstract class CsvConverter extends Job

This class converts CSV input to XML.

Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Field Details

    • CSV

      public static final byte[] CSV
      CSV token.
    • RECORD

      public static final byte[] RECORD
      CSV token.
    • ENTRY

      public static final byte[] ENTRY
      CSV token.
    • NAME

      public static final byte[] NAME
      CSV token.
    • headers

      protected final TokenList headers
      Headers.
    • ats

      protected final boolean ats
      Attributes format.
    • lax

      protected final boolean lax
      Lax QName conversion.
    • col

      protected int col
      Current column.
    • nli

      protected NewlineInput nli
      Current input.
  • Constructor Details

    • CsvConverter

      protected CsvConverter(CsvParserOptions copts)
      Constructor.
      Parameters:
      copts - json options
  • Method Details

    • convert

      public final Item convert(IO input) throws IOException
      Converts the specified input to an XQuery value.
      Parameters:
      input - input
      Returns:
      result
      Throws:
      IOException - I/O exception
    • get

      public static CsvConverter get(CsvParserOptions copts)
      Returns a CSV converter for the given configuration.
      Parameters:
      copts - options
      Returns:
      CSV converter
    • header

      protected abstract void header(byte[] string)
      Adds a new header.
      Parameters:
      string - string
    • record

      protected abstract void record() throws IOException
      Adds a new record.
      Throws:
      IOException - I/O exception
    • entry

      protected abstract void entry(byte[] value) throws IOException
      Called when an entry is encountered.
      Parameters:
      value - string
      Throws:
      IOException - I/O exception
    • init

      protected abstract void init(String uri)
      Initializes the conversion.
      Parameters:
      uri - base URI
    • finish

      protected abstract Item finish() throws IOException
      Returns the resulting XQuery value.
      Returns:
      result
      Throws:
      IOException - I/O exception