最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

java - Dectect deleted element using XMLUnit - Stack Overflow

matteradmin3PV0评论

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!

Post a comment

comment list (0)

  1. No comments so far