xpath


How can i get this value with XPATH in JMeter


I have a webservice response as such :
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Body>
<FileResponse xmlns="http://xxx.x.sx.be">
<id>090150e080249d09</id>
</FileResponse>
</soap:Body>
</soap:Envelope>
I am trying to extract the value of "id" but i can't seem to figure out the right query. I used an online generator which provided :
/soap:Envelope[#xmlns:soap="http://www.w3.org/2003/05/soap-envelope"]/soap:Body/FileResponse[#xmlns="http://xxx.x.sx.be"]/id/text()
But it doesn't seem to work in Jmeter as the response is always null.
I found this to be the answer : //*[local-name() = 'id']
Your test for the namespace is invalid. Xpath queries do not support this.
Instead you will need to JMeter to pass in the namespaces declarations along with the xpath query. I dont know how JMeter does that but I can give you an xpath expression that may work around it.
//*[local-name()='FileResponse']/*[local-name()="id"]/text()
The xpath will test the name of the node and ignoring the namespaces. Its not recomended practice to test without namespaces and could be slow but it'll work.

Related Links

Scrapy xpath fail to find certain div in a webpage
Scrapy: Issues in dealing with Abbr tag in Xpath
XPath for ImportXML in Gsheet
XMLStarlet: selecting nodes using less than / greater than
Date range comparison in CQ using XPATH
I don't understand why this XPath expression is not working as a Scrapy selector
Selenium IDE, check (assert) if a dynamic element contains a specific text
xpath help to get buttons under a class where a link contains some href value
How to write xpath for below code displayed on Image
Fetch element child elements in XQuery
Quickly extract value using xpath
WSO2 ESB- Error Handling - On Error Sequence
Multiple xpath expressions
great ancestor & great great ancestor
How do I convert a string to an int variable in BizTalk XLANG?
extract table rows with XPATH

Categories

HOME
php
libgdx
macos-sierra
cucumber
adfs3.0
dry
plpgsql
cryptography
implicit-conversion
bittorrent
reportviewer
lda
fasm
vimeo
jodatime
twisted
nest-api
vertica
google-sites
tfsbuild
renderscript
spring-ldap
android-permissions
sharedpreferences
device
eclipse-emf
opentext
hevc
sales
ibm-connections
progid
rust-cargo
directfb
djcelery
nanogallery
macports
cartopy
linq.js
slideshow
jqgrid-asp.net
julius-speech
nomad
zend-form
swift2.3
nslayoutconstraint
nivo-slider
network-protocols
zend-server
cognos-tm1
email-injection
ogg
haraka
ternary-operator
yui3
deviare
pjax
google-identity-toolkit
system.net.mail
apple-configurator
frame-grab
jeasyui
vaadin4spring
accessibilityservice
preferenceactivity
stack-smash
asp.net-web-api-helppages
search-form
shoes
scala-macros
scala-swing
otl
rpg
django-sites
lsa
saga
apache-shindig
jquery-transit
virtual-channel
quickgraph
unicoins
proc-open
system-requirements
lynx
nsmutablestring
algol68
exponent
mkannotation
directshow.net
icicles
iphone-sdk-4.3
.net-client-profile
ntruencrypt
prism-2
comment-conventions
watchpoint
account-management

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App