Filtering XML responses with current XPath 1.0 is total pain when lot of namespaces and default namespaces are present (i.e. VMWave API). Simple things like finding some element required ugly //*[local-name() = 'tagName' ] expressions.
XPath 2.0 will allow much simpler expressions, you can use this module for upgrade.
I tried to do it myself, but haven't succeeded in building project, so it might be very helpful if someone could provide proper Dockerfile for app development and building.
馃憢 Thanks for opening your first issue! If you're reporting a 馃悶 bug, please make sure
you include steps to reproduce it. If you're requesting a feature 馃巵, please provide real
use cases that would benefit. 馃應
To help make this a smooth process, please be sure you have first read the
contributing guidelines.
Hey Emreu,
I'd love to try to help with your build issues if you post the errors you're seeing here. I assume you followed the steps on the README already? If you are a Windows user, you may have to follow these steps as well.
Can you explain a bit on what's different about XPath 2? As a side note, I've been thinking about giving plugins the ability to override the response filtering behavior, making it possible to extend it with whatever you want.
As for Docker. It would be awesome to have something like that for Insomnia. I've seen some people get graphical interfaces running in Docker containers but it seems pretty hacky if the host machine isn't Linux.
@gschier, sorry for late reply.
I tried to build again in clean VM with fresh Ubuntu 16.04 Desktop, following instructions from README (also preinstalled libcurl4-openssl-dev package) and faced 2 major problems:
packages/insomnia-app dir by removing everything except dependencies section, but luckily saves backup version. May be some additional parameters should be provided to disable such behavior?node_modules folder, but corresponding sctipts and binaries are not available to npm, which results in errors like sh: 1: concurrently: not found, sh: 1: cross-env: not found etc.This might be stupid problems, but I'm totally miss modern JS ecosystem... %)
As for XPath 2 - I will show example (as soon as I will get to work) of XML document which can't be handled well with XPath 1, but filters perfectly with XPath 2. Its most valuable feature (at least for me) is ability to specify namespace wildcard (like *:SomeElement).
Hey @Emreu,
packages/insomnia-app/node_modules/bin?Also, are you using Node version 8? I will try to test a build on Ubuntu soon to see if I can reproduce the problem.
Yes, I'm using Node version 8 (installed from official ppa).
Right now I don't have access to testing VM, but when I checked earlier packages/insomnia-app/node_modules/bin was empty. I tried to manually npm install some of dev dependencies in empty folder and everything works fine (node_modules/bin were populated). Also when I rerun npm run bootstap it throws error about unconfigured electron-rebuild package.
From all that I assume culprit is lerna.
Gonna try manual package installation later.
By the way here is promised xml document (sorry for zipping it, github not allow XML files):
versions.xml.zip
It is an output of VMWare API where available versions are listed.
It is quite large and unsorted, so I need to filter out <Version/> element, which resides in <VersionInfo deprecated="false"/>.
So I use expression //VersionInfo[@deprecated='false']/Version which returns nothing. Problem here is xmlns attribute on root element, which define default namespace for entire subtree. And in Xpath 1.0 such namespace must be explicitly specified by providing map with namespaces prefixes to library (which is not an option with current Insomnia UI). However mission could be accomplished with pretty ugly expression: //*[local-name()='VersionInfo' and @deprecated='false']/*[local-name()='Version']
XPath 2.0 introduce some new ideas (e.g. 'everything is a sequence'), with new functions and ability to specify wildcard namespace. This allow you to use expression //*:VersionInfo[@deprecated='false']/*:Version to do the job.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I do hope this issue doesn't get closed, as XPath 2.0 will provide much simpler filtering patterns.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Can this please get re-opened @gschier? I don't see any resolution for this issue.
I don't think there is enough demand to include this in the app but I'm willing to accept a PR to add plugin hooks that allow the response filter to be overridden
@gschier , It's really hard to work with XPath 1.0, Please we need XPath 2.0
See issue: https://github.com/getinsomnia/insomnia/issues/1769
For reference:
I can see there is a js library for XPath 3: https://github.com/FontoXML/fontoxpath
I think insomnia having good support for XPath would provide a good alternative to all the super-heavy, super-expensive and often unnecessarily complex corporate solutions. Even if it meant using a plugin... I'm not sure about the complexity of the task for adding such hooks?
Okay, it seems there is demand for this. I think we should still support v1 for backwards compatibility but I'm open to supporting more with a setting to switch between.
Another request for this. My company's namespace is long and using XPath 1.0 is painful.
Essentially the current filtering is useless for any SOAP responses, likely a common reason us enterprise folks are working with XML.
Would love to see support updated.
Most helpful comment
I do hope this issue doesn't get closed, as XPath 2.0 will provide much simpler filtering patterns.