Search code examples
smooks

Can we do string manipulation and conditional check in smooks?


I want to manipulate a large text file, which is coming as TEXT and want to use smooks to manipulate it. The text file contains large number of lines. And from each line, i have to split the characters and get information out of that.

Eg: i do following in java;

row.substring(0, 4) 
row.substring(4, 64) 

I have to convert the text content to CSV file.

  • Can we do exact same string manipulation in smooks too? (that is in smooks configuration can i do that?) I believe i can use Fixed Length processing for that?

  • How to add IF ELSE condition in smooks configuration? Like in java;

    if (row.length() == 900) { //DO }else(){ //DO }


Solution

  • We can do string manipulation using fixed length reader[1]. but still i do not find a way to do condition check.

    Eg: if /else

    [1]http://www.smooks.org/mediawiki/index.php?title=V1.4:Smooks_v1.4_User_Guide#XML