admin管理员组

文章数量:1023230

I´m comparing 2 xmls and trying to detect element deletion.

Old:

<a>
    <b>
        Text 1
    </b>
    <b>
        Text 2
    </b>
    <b>
        Text 3
    </b>
</a>

new:

<a>
    <b>
        Text 2
    </b>
    <b>
        Text 3
    </b>
</a>

The result that I was expecting is:

Deleted element:/a[1]/b[1]

But XmlUnit returns

It compares every node and mark the last one as deleted.

I have already tried ElementSelector.byNameAndText. For this example it works fine but, all other text changes that I may have in the XMl it does not return Text Changed. It returns node deleted and added.

Any ideas how to make it works and if it is possible? Thanks!

I´m comparing 2 xmls and trying to detect element deletion.

Old:

<a>
    <b>
        Text 1
    </b>
    <b>
        Text 2
    </b>
    <b>
        Text 3
    </b>
</a>

new:

<a>
    <b>
        Text 2
    </b>
    <b>
        Text 3
    </b>
</a>

The result that I was expecting is:

Deleted element:/a[1]/b[1]

But XmlUnit returns

It compares every node and mark the last one as deleted.

I have already tried ElementSelector.byNameAndText. For this example it works fine but, all other text changes that I may have in the XMl it does not return Text Changed. It returns node deleted and added.

Any ideas how to make it works and if it is possible? Thanks!

本文标签: javaDectect deleted element using XMLUnitStack Overflow