insomnia: XPath query does not work at all

Expected Behavior

If I try to filter a XML response using XPath query I always get empty result.

<result></result>

For example in the following XML response

<?xml version="1.0" encoding="UTF-8"?>
<store>
    <created_at>27.02.2023 08:19:45</created_at>
    <products>
        <product>
            <UniqueID>20656</UniqueID>
            <Name>Deux Dieux 750ml</Name>
            <Link>https://someurl/</Link>
            <Category>Wine</Category>
            <Vendor>Some Vendor</Vendor>
            <Color>Red</Color>
            <Year></Year>
            <Size>750</Size>
            <Price>33</Price>
            <Availability>Instant Delivery</Availability>
        </product>
    </products>
</store>

Quering for /store or //Name does not return any results

If I query the response using an external tool I get the required results.

I am 100% positive it worked fine previously but I cannot remember when and how it stopped working for me.

Actual Behavior

To get results

Reproduction Steps

  1. Send a GET request to an endpoint returning a XML response.
  2. Perform a XPath query

Is there an existing issue for this?

Additional Information

Things I already tried:

  • Install an older version
  • Install the latest beta (2023.1.0.beta-4)
  • Run the app using Rosetta (M1 sillicon)
  • Disable all plugins
  • Try different API endpoints with alternate responses
  • Validate XML structure using external tool
  • Check if jsonpath-plus is not working as weel (it works for JSON responses)
  • Check DevTools for any errors (No Errors)
  • Download Insomnia from website instead of homebrew
  • Clean application caches (~/Library/Application Support/Insomnia, ~/Library/Preferences/.com.insomnia.*)

Insomnia Version

2023.1.0.beta-4

What operating system are you using?

macOS

Operating System Version

MacOS Ventura 13.2.1

Installation method

homebrew

Last Known Working Insomnia version

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 23 (4 by maintainers)

Most upvoted comments

2023.5.8 didn’t fix this

Ah I knew I’d seen similar code somewhere, thanks for the catch PR up here #6428

image

I did a bit of digging, seems to be because of the library minification of xmldom @stevenp2

Ahh… I’m new to using Insomnia, didn’t know about the use of XPath in templating…

@jackkav looks like https://github.com/Kong/insomnia/blob/develop/packages/insomnia/src/ui/components/templating/local-template-tags.ts#L721-L758 needs to be modified similarly to #6419

it is working now! 👍 With the new update 2023.5.7 I am finally getting results 😃

//offices/office/date

<result>
	<date>
		<![CDATA[17.08.2023]]>
	</date>
	<date>
		<![CDATA[17.08.2023]]>
	</date>
	<date>
		<![CDATA[15.08.2023]]>
	</date>
</result>