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

  • SEARCH
  • Home
  • 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 7414535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:07:06+00:00 2026-05-29T07:07:06+00:00

JDK 1.7.0 XMLUnit 1.3 When comparing this control XML string: String controlXml = +

  • 0

JDK 1.7.0
XMLUnit 1.3

When comparing this control XML string:

            String controlXml = "" +
                "<client>" +
                "   <name>Hello&nbsp;World</name>" +
                "</client>";

With this test XML string:

            String testXml = "" + 
                "<client>" +
                "   <name>Hello&nbsp;World</name>" +
                "</client>";

XMLUNIT returns false and I was expecting it to return true (no differences).

Here is my usage:

XMLUnit.setIgnoreComments(true);
XMLUnit.setIgnoreWhitespace(true);
Diff diff = new Diff(controlXml,testXml);
boolean result = diff.similar(); //result is false

I also get the following error in the console window:

[Fatal Error] :1:103: The entity "nbsp" was referenced, but not declared.

I’m not sure what to do here.

I looked into it and I got some info about EntityResolver using Google but it’s all very confusing.

I need the entity to be treated as plain text. Logically, as plain text, they are equal.

I tried toggling with the following options:

        XMLUnit.setExpandEntityReferences(false);  //tried true, false
        XMLUnit.setIgnoreDiffBetweenTextAndCDATA(false);  //tried true, false

Nothing worked.
Please help, I’m totally lost. Thanks!

  • 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. Editorial Team
    Editorial Team
    2026-05-29T07:07:07+00:00Added an answer on May 29, 2026 at 7:07 am

    It appears that there’s a difference between character entities ( ) and numerical entities ( ).

    XMLUnit has no problems with numerical entities as opposed to character entities.

    I’m thinking that a simple character-entity-to-numerical-entity procedure should be sufficient to resolve my problem.

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

Sidebar

Related Questions

The JDK's String.trim() method is pretty naive, and only removes ascii control characters. Apache
The JDK documentation for java.lang.String.hashCode() famously says: The hash code for a String object
The sun jdk implementation looks like this: return v != v; Can anyone explain
When installing JDK in my machines (Windows 7), I do the following. install latest 1.7
I installed fastdebug build of JDK 6 , and ran this command: java -XX:+PrintCFGToFile
This is Sun JDK 1.6u21, x64. I have a class for the purpose of
I want to change the JDK version 1.5.15 to 1.6.29. If I do this,
This is my setup: JDK 1.5 and JDK 1.6 installed, JAVA_HOME points to JDK
I'm using JDK 7 and testing Play! 1.2.4. I was creating a test class
Environment: Tomcat-6.0.18 Oracle-Db JDK-1.6.0_1 -1- context.xml i a war file - works fine my-application.war/META-INF/context.xml

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.