entityfile = new FileOutputStream(getOutputDirectory(rs)+number+root+"_entities_before.xml");
RArray entitystack = RArray.newArray(session,false,false);
for(int i=0; i< session.getState().edepth()-2; i++){
entitystack.add(session.getState().entityfetch(i));
}
session.printEntityReport(new XMLPrinter(entityfile), false, false, session.getState(), "entitystack", entitystack);
}
// Once the data is loaded, execute the rules.
RulesException ex = null;
try{