I would like to fulfill the following task. I am not sure if it is possible to do so the way I planed but therefore my question:
I’d like to write a Java program to allow users to load XML or CSV files and to manipulate and use their content in some sort of scripting environment like Rhino or Beanshell. The scripting should look something like this:
var myData = new dataLoader(“some_file.csv”);
myData.load(); // should load the content
(while myData.next()) {
If( myData.status == “pending”) {
myData.value = myData.value + 1;
myData.status = “updated”; //set new status
myData.update(); //update dataset
}
}
Some_file.csv:
“value”; “status”;
“1”; “pending”;
“21”; “pending”;
“341”; “pending”;
Is this possible (to dynamically provide methods/functions/variables based on the file’ content)? If so any idea what my class “dataLoader” should look like? I would also appreciate a piece of advice where to start looking. Thank you for your help, Stephanie