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

XQuery/XPath: Using count() and max() function for return of element with highest count
Double iteration over a nodeset in XSLT-1.0
What is the correct XPath query for 'select onchange'
XPath 2.0: Retrieving nodes by attribute where value is case Insensitive
XPath - abbreviation of position() function
XPath Query in JMeter
xpath expression to select attribute value
DOMDocument xpath query cut off time
How to parse the following html code get all text before “br” tag
XPath selector by class AND index
How to perform set operations in XPath 1.0
extract data from a div that have no class using xpath
Xpath: Select node but not specific child elements
XQuery - How to use eq (=) on a group of values
better selenium xpath is expecting
How to get only numbers from string with XPath

Categories

HOME
apache-nifi
list
livecode
apk
typeerror
consul
tabs
tcp
biztalk-2010
implicit-conversion
turbojpeg
angular2-template
responsive-design
timber
log4j2
heuristics
createjs
pushdown-automaton
vmware-workstation
uima
coroutine
bluemix-mobile-services
node-webkit
pe
unity-container
anova
sybase-ase
perfino
firemonkey-style
webviewclient
onchange
sales
unmarshalling
splunk-query
docx4j
nic
xenapp
xcrun
cloudera-manager
xmlunit
serversocket
adminer
buildforge
textmate2
djcelery
forms-authentication
microsoft-ui-automation
rdp
export-to-pdf
icepdf
robust
liteide
tinyioc
sequence-diagram
deedle
clrs
sesame
dblink
hmmlearn
cognos-tm1
cocoa-bindings
metabase
jenkins-workflow
meld
wicked-pdf
accessibilityservice
i2b2
cortana
dsa
uitest
modern.ie
google-gdk
subfolder
mathematical-expressions
n-tier-architecture
cakephp-2.2
zend-mail
relationships
otl
siena
category-theory
android-2.3-gingerbread
hyperloglog
commenting
zend-search-lucene
pageviews
preorder
usb-flash-drive
cloo
application-blocks
visual-c++-2005
san
mp4parser
insertion
ofstream
examine
contextswitchdeadlock
gprof
xalan
playorm
android-dialog
coordinate
word-frequency
thejit
monocross
acpi
differentiation
office-automation
jquery-1.4
asdoc
sqlsitemapprovider
gui-designer
downloadfile
service-factory

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