Menu

Skip all differenence if No of elements in contol node are more than test node (show only parent)

Help
naveen
2013-11-20
2013-11-24
  • naveen

    naveen - 2013-11-20
    I have control document as below    
    <sample>
        <cont>
            <lt>
                <param>
                    <id>1</id>
                    <names>
                        <name>kk</name>
                        <name>abc</name>
                    </names>
                </param>
                <param>
                    <id>2</id>
                    <names>
                        <name>xyz</name>
                        <name>obc</name>
                    </names>
                </param>
                <param>
                    <id>3</id>
                    <names>
                        <name>asdsad</name>
                        <name>asdasdsd</name>
                    </names>
                </param>
            </lt>
        </cont>
    </sample>
    
    Test node as below
    <sample>
        <cont>
            <lt>
                <param>
                    <id>1</id>
                    <names>
                        <name>kk</name>
                        <name>abc</name>
                    </names>
                </param>
                <param>
                    <id>2</id>
                    <names>
                        <name>xyz</name>
                        <name>obc</name>
                    </names>
                </param>
            </lt>
        </cont>
    </sample>
    

    When i ran XMLUnit.compareXML(control,test node). Giving me 3 differences. and source document last child is being compared with testnode last element. But it should not happen as the element itslef not present(last param), It should return me only 1 difference(Currently it is comparing against each element/attribute).

    How to skip differences of childs if parent is not found in the above case.

    Please let me know your valuable suggestions

     

Log in to post a comment.

MongoDB Logo MongoDB