FSD Field tag

The field element specifies a single field in the input or output data.

Attributes

  • name

    Specifies the name of the field. If the output attribute is set to yes then this name is used as the XML tag name in the output, and used to match the choice with an XML tag during input.

  • output

    Specifies if the field is to be included in the output. The valid values for this attribute are:

    • yes

      the record generates a tag in the output

    • no

      the field describes only the data structure and can be used to skip data.

    The default value is yes.

  • record-sep

    Specifies an optional field separator string for the field. This can be any string value. These special values can also be used:

    • \r

      the carriage-return character

      \n
    • the line-feed character

    • \t

      the tab character.

    The data is fixed-length. The max-length attribute is used if no field separator is specified.

    The last field in a record uses the record separator, not the field separator.

  • valid-value

    Defines a fixed value for the field. It is used to validate flat data, and also as part of the pattern matching in the choice element. If the output attribute is set to no for flat data, then 'valid-value' is written to the flat file instead.

  • leading-chars

    Specifies a string that, if found, must be removed from the beginning of a field. If the 'trailing-chars' attribute is not specified, then the first of these characters is used to left-pad the value if it is shorter than the length specified by the 'min-length' attribute.

  • trailing-chars

    Specifies a string that, if found, must be removed from the end of a field. The first of these characters is used to right-pad the value if it is shorter than the length specified by the 'min-length' attribute.

  • output-if-empty

    Specifies if a field is to be written, even if it is empty. The valid values for this attribute are yes and no. The default value is no.

  • max-length

    Defines the maximum length of the data. This value specifies how much data should be read. The default value is 128.

  • min-length

    Defines the minimum length of the data. This value is used for validation, pattern matching by the 'choice' element, and also for padding when the 'leading-chars' or 'trailing-chars' attributes are specified. The default value is 0.

  • truncate

    If this attribute is set to yes then the data written to the flat file is truncated to the specified max-length. The default value is no.

  • quoted

    Specifies if quotation marks should be placed around the data. This enables the field separator to appear in the output data, as the FSD processor will not search a quoted string for the field separator. This attribute has the values:

    • No

      The data is not treated as a quoted string and is written verbatim in and out of the flat file.

    • Yes

      The data is treated as a quoted string. When converting from flat format to XML, quotation marks in the data are removed and any spare quotation marks are converted to single quotation marks.

    When converting from XML format to flat file format, the data is surrounded in quotation marks. Any spare quotation marks are 'escaped', that is, a single quotation mark is converted to a double quotation mark. This means " is converted to "" and so on.

  • Auto

    This option only applies when converting delimited flat file data to XML. If the data contains the field separator, it is treated as if the quoted option is set to yes.

    The default value is auto.