-
October 19th, 2021, 05:05 PM
#1
Xpath expression to extract value from a node/element
Hi,
Please see the xml below. I am trying to write an Xpath expression to retrieve the string value from the element "SessionID". The code I wrote,
./IDMResponse/Worker/SessionId/text()
or
./WorkerID/SessionId/text()
returns no value. Please help me with this.
<?xml version="1.0" encoding="utf-8"?>
<IDMResponse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" MajorVersion="1" xmlns="http://www.nrf-arts.org/IXRetail/namespace/">
<ARTSHeader>
<MessageID>1</MessageID>
<Response ResponseCode="Ok">
<RequestID>1</RequestID>
</Response>
</ARTSHeader>
<Worker MajorVersion="1" MinorVersion="0" FixVersion="1">
<WorkerID>9968632a-fbb2-41a7011cab</WorkerID>
<AllowedForBarcodeAuthentication>false</AllowedForBarcodeAuthentication>
<LegalName><Name>jam</Name>
<FullName>jam admin</FullName>
</LegalName>
<DisplayName>dax</DisplayName>
<SecurityIdentifier TypeCode="UserName">jamadmin</SecurityIdentifier>
<WorkLocation><HomeStore /></WorkLocation>
<SessionId>194e7418-600e2b0fb</SessionId>
<DaysToExpire>-1</DaysToExpire>
</Worker>
</IDMResponse>
-
October 20th, 2021, 02:57 AM
#2
Re: Xpath expression to extract value from a node/element
1. Please, post every code/script.xml block to be properly formatted and indented. Use Code tags for this.
Example: you write:
[CODE]some code ...
indentation ...[/CODE]
and we will see
Code:
some code ...
indentation ...
2. You didn't provide any code "you wrote" to parse this xml.
Victor Nijegorodov
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|