1

I want to compare two XML files. I am using XMLUnit to compare. I am having some problem while comparing like the following xml snippets.

Expected:

<Detail>
    <Participant>
        <PersonalInfo>
        <SSN>405018111</SSN>
        <!--<Title>MR</Title>-->
    </PersonalInfo>
    <!--<PersonalDemo>
        <Email>someemail@email.com</Email>
        <EDeliveryFlag>true</EDeliveryFlag>
    </PersonalDemo>-->
</Detail>

ACTUAL:

<Detail>
    <Participant>
        <PersonalInfo>
        <SSN>405018111</SSN>
        <Title>MR</Title>
    </PersonalInfo>
    <PersonalDemo>
        <Email>someemail@email.com</Email>
        <EDeliveryFlag>false</EDeliveryFlag>
    </PersonalDemo>
</Detail>
  1. It will fail, because "Title" tag is missing (because it is commented out) in EXPECTED while it is present in ACTUAL
  2. It will fail, because "PersonalDemo" tag is missing (because it is commented out) in EXPECTED while it is present in ACTUAL
  3. It will fail, because, "PPSDetails" has different number of child nodes (because commented out nodes are not considered) in EXPECTED and in ACTUAL

What I actually need is that I want to ignore those Elements in ACTUAL that are commented out in EXPECTED

any help please

4

1 に答える 1