To test , we have two tables
1) Dept normal dept table
2) DelDept an empty table with the same structure
public void getView1(){
ViewObject vo = this;
Node xml1 = vo.writeXML(-1,XMLInterface.XML_OPT_ALL_ROWS); // here xml1 contains the DEPT rows
// try {
// printXML(xml1);
// } catch (IOException e) {
// }
ViewObject vo2 = this.getApplicationModule().findViewObject("deldept1");
vo2.readXML((Element) xml1, -1); -- The XML elements are read into the view object ..
//BIG COMMENT, if you run the method twice, the vo2 viewobject will not have the rows duplicated.. because the readXML compares existing rows with the rows being read and will not load the duplicate data again based on its PK
System.out.println(vo2.getEstimatedRangePageCount());
}
private static void printXML(Node n) throws IOException {
((XMLNode)n).print(System.out);
}