# How to display mismatches in Two XML Responses Comparison?

**URL:** <https://community.postman.com/t/how-to-display-mismatches-in-two-xml-responses-comparison/75439>\
**Category:** Help Hub\
**Tags:** compare-two-response\
**Created:** [February 14, 2025, 5:19am UTC](https://community.postman.com/t/how-to-display-mismatches-in-two-xml-responses-comparison/75439 "2025-02-14T05:19:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![smrajasubramanian](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@smrajasubramanian](https://community.postman.com/u/smrajasubramanian)\
**Post date:** [February 14, 2025, 5:19am UTC](https://community.postman.com/t/how-to-display-mismatches-in-two-xml-responses-comparison/75439/1 "2025-02-14T05:19:20Z")

</div>

How to display mismatches in Two XML Responses Comparison?

**Endpoint:** [TempConvert Web Service](https://www.w3schools.com/xml/tempconvert.asmx)

**Request A:**  
**Body:**

```auto
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
   <FahrenheitToCelsius xmlns="https://www.w3schools.com/xml/">
     <Fahrenheit>100</Fahrenheit>
   </FahrenheitToCelsius>
  </soap:Body>
</soap:Envelope>

```

**Test Script:**  
// Fixed JSONError by removing JSON.stringify and replacing " with "

```auto
let jsonData = pm.response.text();

jsonData = jsonData.replace(/&quot;/g, '"'); // Replace &quot; with "

pm.collectionVariables.set("responseA", jsonData);

```

**Request B:**  
**Body:**

```auto
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
   <FahrenheitToCelsius xmlns="https://www.w3schools.com/xml/">
     <Fahrenheit>1000</Fahrenheit>
   </FahrenheitToCelsius>
  </soap:Body>
</soap:Envelope>

```

**Test Script:**

```auto
let responseA = pm.collectionVariables.get("responseA");
let responseB = pm.response.text();

pm.test("Compare responses", function () {
    pm.expect(responseA).to.equal(responseB);
});

```

**Expected Result:**  
Test Script should show what are the mismatches occurs

**Actual result:**  
Showing Error alone without mismatches details.  
**Error:**  
failed  
Compare responses | AssertionError: expected undefined to equal ‘\<?xml version=“1.0” encoding=“utf-8”?…’

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [February 14, 2025, 2:33pm UTC](https://community.postman.com/t/how-to-display-mismatches-in-two-xml-responses-comparison/75439/2 "2025-02-14T14:33:24Z")

</div>

ResponseA is coming back as defined, so it doesn’t look like its pulling in the info from your collection variable. So at the moment, its comparing your response text with undefined.

Doing a DIFF with native JavaScript is complex, and Postman doesn’t have any additional libraries in the sandbox to help do you do this.

It will do a simple compare, and yes, it will be hard (or impossible) to read if there are multiple differences.

This may be a test where you have an initial error so you know there is a difference which means that you then have to perform some manual testing (by coping and pasting the two responses into an external tool or website to perform the DIFF fully).

---

<div class="post-metadata">

**Author:** ![smrajasubramanian](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@smrajasubramanian](https://community.postman.com/u/smrajasubramanian)\
**Post date:** [February 15, 2025, 4:07am UTC](https://community.postman.com/t/how-to-display-mismatches-in-two-xml-responses-comparison/75439/3 "2025-02-15T04:07:32Z")

</div>

Is it possible to delete some tags in stored variable response?
