Postman Tutorial Part 53 – Extracting Value From XML Response in Postman

As a part of Postman Tutorial – End to End , in this post, we will learn how can we extract value from XML response in Postman.

Already, we learnt how can we send a XML and parameterized XML payload in Postman. In this post we will learn to extract values form XML response and assert.

Extracting or parsing XML response in Postman is little tricky. Let’s learn it.

Consider XML response as below :-

First you need to convert above XML response to JSON.

var response = xml2Json(responseBody)

This “response” will be root node similar to <head> tag in html DOM. Now we need to travel node by node. For example:- To reach node “firstName”, you need to start from root node -> created-booking – > booking -> firstname. It is similar to absolute XPath.

syntax:- rootNode[“node1”][“node2”][“node3”]

Let’s write whole code for above XML response :-

Import above example collection from here.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.

You can find all Selenium related post here.
You can find all API manual and automation related posts here.
You can find frequently asked Java Programs here.

Table of Contents

Author: Amod Mahajan

A software Tester who is paid to judge products developed by others. Writing technical posts and creating YouTube videos are my hobbies.

2 thoughts on “Postman Tutorial Part 53 – Extracting Value From XML Response in Postman

  1. I am having difficulty with this- my root node I need to access contains multiple elements. How do I access one of the elements within the root node?

  2. Special thanks to you for covering the various aspects of postman. It was great to see 53 tutorials

    When we have already converted xml2json why do we need to access like [][] and not by .

    Can you cover them how to save this as code repository?
    Cover other methods as well

Leave a Reply

Please wait...

Subscribe to new posts to become automation expert

Want to be notified when my new post is published? Get my posts in your inbox.