listing test elements not in control

Help
Lou
2008-10-17
2013-03-03
  • Lou
    Lou
    2008-10-17

    I'm having a problem seeing the elements that are in the test xml and not in the control xml.  Given the files:

    control
    <po>
    <order>abc</order>
    </po>

    test
    <po>
    <order>abc</order>
    <order_item_t>
    <somedate>2008-10-11</somedate>
    <order_item>TITANIC350</order_item>
    </order_item_t>
    <order_item_t>
    <somedate>2008-10-11</somedate>
    <order_item>TITANIC350</order_item>
    </order_item_t>
    </po>

    When I run this through the diff, I get the following:

    Expected number of child nodes '1' but was '3' - comparing <po...> at /po[1] to <po...> at /po[1]
    --------------------------------------------------
    Expected presence of child node 'null' but was 'order_item_t' - comparing  at null to <order_item_t...> at /po[1]/order_item_t[1]
    --------------------------------------------------
    Expected presence of child node 'null' but was 'order_item_t' - comparing  at null to <order_item_t...> at /po[1]/order_item_t[2]
    --------------------------------------------------

    I need to get the new elements within the <order_item_t> tag - any way to do this?

     
    • Stefan Bodewig
      Stefan Bodewig
      2008-10-17

      the Differences returned contain a NodeDetail instance for both the control and the test element.  The one for the test element will contain a non-null Node pointing to your order_item_t elements and you can traverse the child nodes from there using DOM.

       
      • Lou
        Lou
        2008-10-17

        OK, that was what I started coding, but I just wanted to be sure I was not missing something simple.
        Thanks.