Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Can someone explain what is the proper way to check for absent elements. Given the following snippet:
Difference diff = (Difference)iter.next();
NodeDetail ndSrc = diff.getControlNodeDetail();
NodeDetail ndTst = diff.getTestNodeDetail();
String sname = "?";
String srcVal = "?";
String dname = "?";
String tstVal = "?";
String ndSrcVal = ndSrc.getValue();
String ndTstVal = ndTst.getValue();
I was using the values returned from the getValue() calls to check for the string "null" and then classify the change as insert, update or delete. For example, if the control/src value is null, but the test value is not, then it must be an add.
So, given the following XML fragment:
I'm getting the following results:
control value returned: false
test value returned: true
I could swear this was returning the string "null" - could it be related to the qualifier I am using? What should I expect from these calls when the nodes are absent?
the first difference you get will be about different numbers of children and both will point at /dummyroot.
Uhm no, the first difference probably is HAS_CHILD_NODES and explains the false/true values.
See the tables in