Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 148261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:55:37+00:00 2026-05-11T08:55:37+00:00

I am trying to compare 2 XML files using XMLUnit 1.2. I am using

  • 0

I am trying to compare 2 XML files using XMLUnit 1.2. I am using the RecursiveElementNameAndTextQualifier() qualifier.

When changing the order of some entities order in my XML, it causes XMLUnit to pass on some cases and fail on other cases.

My XML file looks like this, and I’m comparing it to a similar copy with a simple location swapping of one peer of attributes.

<root>    <ent>     <value>       <int>1</int>      </value>     <value>      <int>2</int>      </value>    </ent>     <ent>     <value>       <int>3</int>      </value>     <value>       <int>4</int>      </value>    </ent>  </root>   

When swapping int: 1 with int: 2 , in one of the XML files, the test fails. But when swapping int:4 with int:3 it keeps passing.

Here is my testing code:

public void testRecursiveElement() throws Exception {    InputSource xml1 = new InputSource('xml1.xml');  InputSource xml2 = new InputSource('xml2.xml');   Diff myDiff = new Diff(xml1, xml2);  myDiff.overrideElementQualifier(new RecursiveElementNameAndTextQualifier() );   assertXMLEqual('Not similar', myDiff, true);  }  

Can you advice what is the problem , and why does XMLUnit detect a diff in the first case and not in the second case. Is there any solution to this problem ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T08:55:38+00:00Added an answer on May 11, 2026 at 8:55 am

    I’ve tried to reproduce the behavior you described but didn’t succeed. When using the RecursiveElementNameAndTextQualifier the order of the elements doesn’t seem to matter. So neither swapping int:1 and int:2, nor swapping int:3 and int:4 led to an assertion error in my tests.

    I don’t know which behavior you’d expect, but changing the RecursiveElementNameAndTextQualifier to a ElementNameAndTextQualifier led to assertion errors for both swapping cases.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 108k
  • Answers 108k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer If you are just looking to display a satellite map… May 11, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer I've used Confluence at a number of places, it's a… May 11, 2026 at 9:16 pm
  • Editorial Team
    Editorial Team added an answer I'd say "yes, this is dirty." Your intention isn't to… May 11, 2026 at 9:16 pm

Related Questions

compiling with gcc C99 I am trying to compare 2 string using string compare.
I am trying to compare the performance of boost::multi_array to native dynamically allocated arrays,
I am trying to test the likelihood that a particular clustering of data has
I am trying to teach myself Python by working through some problems I came

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.