@Override
  public String getXML() {
    StringBuilder retval = new StringBuilder( 1024 );
    normilizeAllocation();

    retval.append( "    " ).append( XMLHandler.addTagValue( "header", startsWithHeader ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "noempty", ignoreEmptyRows ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "stoponempty", stopOnEmpty ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "filefield", fileField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "sheetfield", sheetField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "sheetrownumfield", sheetRowNumberField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "rownumfield", rowNumberField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "sheetfield", sheetField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "filefield", fileField ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "limit", rowLimit ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "encoding", encoding ) );
    retval.append( "    " + XMLHandler.addTagValue( "add_to_result_filenames", isaddresult ) );

    retval.append( "    " ).append( XMLHandler.addTagValue( "accept_filenames", acceptingFilenames ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "accept_field", acceptingField ) );
    retval.append( "    " ).append(
      XMLHandler.addTagValue( "accept_stepname",
        ( acceptingStep != null ? acceptingStep.getName() : StringUtil.EMPTY_STRING ) ) );

    /*
     * Describe the files to read
     */
    retval.append( "    <file>" ).append( Const.CR );
    for ( int i = 0; i < fileName.length; i++ ) {
      retval.append( "      " ).append( XMLHandler.addTagValue( "name", fileName[ i ] ) );
      retval.append( "      " ).append( XMLHandler.addTagValue( "filemask", fileMask[ i ] ) );
      retval.append( "      " ).append( XMLHandler.addTagValue( "exclude_filemask", excludeFileMask[ i ] ) );
      retval.append( "      " ).append( XMLHandler.addTagValue( "file_required", fileRequired[ i ] ) );
      retval.append( "      " ).append( XMLHandler.addTagValue( "include_subfolders", includeSubFolders[ i ] ) );
    }
    retval.append( "    </file>" ).append( Const.CR );

    /*
     * Describe the fields to read
     */
    retval.append( "    <fields>" ).append( Const.CR );
    for ( int i = 0; i < field.length; i++ ) {
      retval.append( "      <field>" ).append( Const.CR );
      retval.append( "        " ).append( XMLHandler.addTagValue( "name", field[ i ].getName() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "type", field[ i ].getTypeDesc() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "length", field[ i ].getLength() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "precision", field[ i ].getPrecision() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "trim_type", field[ i ].getTrimTypeCode() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "repeat", field[ i ].isRepeated() ) );

      retval.append( "        " ).append( XMLHandler.addTagValue( "format", field[ i ].getFormat() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "currency", field[ i ].getCurrencySymbol() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "decimal", field[ i ].getDecimalSymbol() ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "group", field[ i ].getGroupSymbol() ) );

      retval.append( "      </field>" ).append( Const.CR );
    }
    retval.append( "    </fields>" ).append( Const.CR );

    /*
     * Describe the sheets to load...
     */
    retval.append( "    <sheets>" ).append( Const.CR );
    for ( int i = 0; i < sheetName.length; i++ ) {
      retval.append( "      <sheet>" ).append( Const.CR );
      retval.append( "        " ).append( XMLHandler.addTagValue( "name", sheetName[ i ] ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "startrow", startRow[ i ] ) );
      retval.append( "        " ).append( XMLHandler.addTagValue( "startcol", startColumn[ i ] ) );
      retval.append( "        </sheet>" ).append( Const.CR );
    }
    retval.append( "    </sheets>" ).append( Const.CR );

    // ERROR HANDLING
    retval.append( "    " ).append( XMLHandler.addTagValue( "strict_types", strictTypes ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "error_ignored", errorIgnored ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "error_line_skipped", errorLineSkipped ) );

    retval.append( "    " ).append(
      XMLHandler.addTagValue( "bad_line_files_destination_directory", warningFilesDestinationDirectory ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "bad_line_files_extension", warningFilesExtension ) );
    retval.append( "    " ).append(
      XMLHandler.addTagValue( "error_line_files_destination_directory", errorFilesDestinationDirectory ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "error_line_files_extension", errorFilesExtension ) );
    retval.append( "    " ).append(
      XMLHandler.addTagValue( "line_number_files_destination_directory", lineNumberFilesDestinationDirectory ) );
    retval.append( "    " ).append(
      XMLHandler.addTagValue( "line_number_files_extension", lineNumberFilesExtension ) );

    retval.append( "    " ).append( XMLHandler.addTagValue( "shortFileFieldName", shortFileFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "pathFieldName", pathFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "hiddenFieldName", hiddenFieldName ) );
    retval.append( "    " ).append(
      XMLHandler.addTagValue( "lastModificationTimeFieldName", lastModificationTimeFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "uriNameFieldName", uriNameFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "rootUriNameFieldName", rootUriNameFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "extensionFieldName", extensionFieldName ) );
    retval.append( "    " ).append( XMLHandler.addTagValue( "sizeFieldName", sizeFieldName ) );

    retval.append( "    " ).append( XMLHandler.addTagValue( "spreadsheet_type",
      ( spreadSheetType != null ? spreadSheetType.toString() : StringUtil.EMPTY_STRING ) ) );

    retval.append( "    " )
      .append( XMLHandler.addTagValue( "password", Encr.encryptPasswordIfNotUsingVariables( password ) ) );

    return retval.toString();
  }
@Test
  public void testGetXML() throws KettleException {
    Assert.assertEquals(
      "    <header>N</header>" + SystemUtils.LINE_SEPARATOR
        + "    <noempty>N</noempty>" + SystemUtils.LINE_SEPARATOR
        + "    <stoponempty>N</stoponempty>" + SystemUtils.LINE_SEPARATOR
        + "    <filefield/>" + SystemUtils.LINE_SEPARATOR
        + "    <sheetfield/>" + SystemUtils.LINE_SEPARATOR
        + "    <sheetrownumfield/>" + SystemUtils.LINE_SEPARATOR
        + "    <rownumfield/>" + SystemUtils.LINE_SEPARATOR
        + "    <sheetfield/>" + SystemUtils.LINE_SEPARATOR
        + "    <filefield/>" + SystemUtils.LINE_SEPARATOR
        + "    <limit>0</limit>" + SystemUtils.LINE_SEPARATOR
        + "    <encoding/>" + SystemUtils.LINE_SEPARATOR
        + "    <add_to_result_filenames>N</add_to_result_filenames>" + SystemUtils.LINE_SEPARATOR
        + "    <accept_filenames>N</accept_filenames>" + SystemUtils.LINE_SEPARATOR
        + "    <accept_field/>" + SystemUtils.LINE_SEPARATOR
        + "    <accept_stepname/>" + SystemUtils.LINE_SEPARATOR
        + "    <file>" + SystemUtils.LINE_SEPARATOR
        + "      <name>1</name>" + SystemUtils.LINE_SEPARATOR
        + "      <filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <exclude_filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <file_required/>" + SystemUtils.LINE_SEPARATOR
        + "      <include_subfolders/>" + SystemUtils.LINE_SEPARATOR
        + "      <name>2</name>" + SystemUtils.LINE_SEPARATOR
        + "      <filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <exclude_filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <file_required/>" + SystemUtils.LINE_SEPARATOR
        + "      <include_subfolders/>" + SystemUtils.LINE_SEPARATOR
        + "      <name>3</name>" + SystemUtils.LINE_SEPARATOR
        + "      <filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <exclude_filemask/>" + SystemUtils.LINE_SEPARATOR
        + "      <file_required/>" + SystemUtils.LINE_SEPARATOR
        + "      <include_subfolders/>" + SystemUtils.LINE_SEPARATOR
        + "    </file>" + SystemUtils.LINE_SEPARATOR
        + "    <fields>" + SystemUtils.LINE_SEPARATOR
        + "      <field>" + SystemUtils.LINE_SEPARATOR
        + "        <name>1</name>" + SystemUtils.LINE_SEPARATOR
        + "        <type>String</type>" + SystemUtils.LINE_SEPARATOR
        + "        <length>1</length>" + SystemUtils.LINE_SEPARATOR
        + "        <precision>-1</precision>" + SystemUtils.LINE_SEPARATOR
        + "        <trim_type>none</trim_type>" + SystemUtils.LINE_SEPARATOR
        + "        <repeat>N</repeat>" + SystemUtils.LINE_SEPARATOR
        + "        <format/>" + SystemUtils.LINE_SEPARATOR
        + "        <currency/>" + SystemUtils.LINE_SEPARATOR
        + "        <decimal/>" + SystemUtils.LINE_SEPARATOR
        + "        <group/>" + SystemUtils.LINE_SEPARATOR
        + "      </field>" + SystemUtils.LINE_SEPARATOR
        + "      <field>" + SystemUtils.LINE_SEPARATOR
        + "        <name>2</name>" + SystemUtils.LINE_SEPARATOR
        + "        <type>String</type>" + SystemUtils.LINE_SEPARATOR
        + "        <length>2</length>" + SystemUtils.LINE_SEPARATOR
        + "        <precision>-1</precision>" + SystemUtils.LINE_SEPARATOR
        + "        <trim_type>none</trim_type>" + SystemUtils.LINE_SEPARATOR
        + "        <repeat>N</repeat>" + SystemUtils.LINE_SEPARATOR
        + "        <format/>" + SystemUtils.LINE_SEPARATOR
        + "        <currency/>" + SystemUtils.LINE_SEPARATOR
        + "        <decimal/>" + SystemUtils.LINE_SEPARATOR
        + "        <group/>" + SystemUtils.LINE_SEPARATOR
        + "      </field>" + SystemUtils.LINE_SEPARATOR
        + "    </fields>" + SystemUtils.LINE_SEPARATOR
        + "    <sheets>" + SystemUtils.LINE_SEPARATOR
        + "      <sheet>" + SystemUtils.LINE_SEPARATOR
        + "        <name>1</name>" + SystemUtils.LINE_SEPARATOR
        + "        <startrow>0</startrow>" + SystemUtils.LINE_SEPARATOR
        + "        <startcol>0</startcol>" + SystemUtils.LINE_SEPARATOR
        + "        </sheet>" + SystemUtils.LINE_SEPARATOR
        + "      <sheet>" + SystemUtils.LINE_SEPARATOR
        + "        <name>2</name>" + SystemUtils.LINE_SEPARATOR
        + "        <startrow>0</startrow>" + SystemUtils.LINE_SEPARATOR
        + "        <startcol>0</startcol>" + SystemUtils.LINE_SEPARATOR
        + "        </sheet>" + SystemUtils.LINE_SEPARATOR
        + "      <sheet>" + SystemUtils.LINE_SEPARATOR
        + "        <name>3</name>" + SystemUtils.LINE_SEPARATOR
        + "        <startrow>0</startrow>" + SystemUtils.LINE_SEPARATOR
        + "        <startcol>0</startcol>" + SystemUtils.LINE_SEPARATOR
        + "        </sheet>" + SystemUtils.LINE_SEPARATOR
        + "      <sheet>" + SystemUtils.LINE_SEPARATOR
        + "        <name>4</name>" + SystemUtils.LINE_SEPARATOR
        + "        <startrow>0</startrow>" + SystemUtils.LINE_SEPARATOR
        + "        <startcol>0</startcol>" + SystemUtils.LINE_SEPARATOR
        + "        </sheet>" + SystemUtils.LINE_SEPARATOR
        + "    </sheets>" + SystemUtils.LINE_SEPARATOR
        + "    <strict_types>N</strict_types>" + SystemUtils.LINE_SEPARATOR
        + "    <error_ignored>N</error_ignored>" + SystemUtils.LINE_SEPARATOR
        + "    <error_line_skipped>N</error_line_skipped>" + SystemUtils.LINE_SEPARATOR
        + "    <bad_line_files_destination_directory/>" + SystemUtils.LINE_SEPARATOR
        + "    <bad_line_files_extension/>" + SystemUtils.LINE_SEPARATOR
        + "    <error_line_files_destination_directory/>" + SystemUtils.LINE_SEPARATOR
        + "    <error_line_files_extension/>" + SystemUtils.LINE_SEPARATOR
        + "    <line_number_files_destination_directory/>" + SystemUtils.LINE_SEPARATOR
        + "    <line_number_files_extension/>" + SystemUtils.LINE_SEPARATOR
        + "    <shortFileFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <pathFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <hiddenFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <lastModificationTimeFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <uriNameFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <rootUriNameFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <extensionFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <sizeFieldName/>" + SystemUtils.LINE_SEPARATOR
        + "    <spreadsheet_type/>" + SystemUtils.LINE_SEPARATOR
        + "    <password>Encrypted </password>" + SystemUtils.LINE_SEPARATOR, meta.getXML() );
  }