# # # compare_node_existence.cfv # # subroutine(compare_node_existence( node a_ori, node b_ori), ( debug_message("#### compare_node_existence() \n"); # This subroutine compares two nodes without its values (values are not compared!) and displays any node differences in a HTML table. # The order of the subnodes is not relevant. Nodes which are sorted differently but have # the same subnodes and values will show that the two nodes are equal. # # # # compare_node_existence_a_against_b() # # # subroutine(compare_node_existence_a_against_b( node a, node b, node c), ( node item; string item_value; string item_path; string parent_path; foreach item a ( if (num_subnodes(item) > 0) then ( compare_node_existence_a_against_b(item, b, c); ) else ( item_path = replace_first(item, "v.compare_node_existence_a.", ""); # debug_message("#### item_path in a: " . item_path . "\n"); if (!?(b . "." . item_path)) then ( # Track that the node only exists in a # debug_message("#### TRACK NODE IN C\n\n"); c . "." . item_path . ".__node_exists_in_a__" = true; c . "." . item_path . ".__node_exists_in_b__" = false; ); ); ); )); # # # # compare_node_existence_b_against_a() # # # subroutine(compare_node_existence_b_against_a( node a, node b, node c), ( node item; string item_name; string item_path; foreach item b ( # debug_message("#### item: " . item . "\n"); # debug_message("#### num_subnodes(item): " . num_subnodes(item) . "\n"); if (num_subnodes(item) > 0) then ( compare_node_existence_b_against_a(a, item, c); ) else ( item_path = replace_first(item, "v.compare_node_existence_b.", ""); # debug_message("#### item_path of item in b: " . item_path . "\n"); # If this subnode does not exist in a then add it to c, # else it has already been covered in compare_node_existence_a_against_b if (!?(a . "." . item_path)) then ( c . "." . item_path . ".__node_exists_in_a__" = false; c . "." . item_path . ".__node_exists_in_b__" = true; ); ); ); )); # # # # compare_node_existence_create_node_differences_html() # # # subroutine(compare_node_existence_create_node_differences_html( node c), ( node item; string item_name; string item_path; foreach item c ( if (item?{"__node_exists_in_a__"} and item?{"__node_exists_in_b__"}) then ( item_path = replace_first(item, "v.compare_node_existence_c.", ""); # Show the item '
' . a_ori . ' | '; # ''; # ' | '; ' | ' . b_ori . ' | '; # ''; # ' | '; ' |
---|