Driver XPath Get XML element value

I have the XML response in Driver's local variable 'lv-Result'.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.partner.soap.sforce.com">
    <soapenv:Header>
        <LimitInfoHeader>
            <limitInfo>
                <current>142795</current>
                <limit>49754000</limit>
                <type>API REQUESTS</type>
            </limitInfo>
        </LimitInfoHeader>
    </soapenv:Header>
    <soapenv:Body>
        <queryAllResponse>
            <result xsi:type="QueryResult">
                <done>true</done>
                <queryLocator xsi:nil="true"/>
                <records xsi:type="sf:sObject">
                    <sf:type>User</sf:type>
                    <sf:Id>005030000040AQeAAM</sf:Id>
                    <sf:Id>005030000040AQeAAM</sf:Id>
                </records>
                <size>1</size>
            </result>
        </queryAllResponse>
    </soapenv:Body>
</soapenv:Envelope>

I want to get the value of <sf:Id>005030000040AQeAAM</sf:Id> and <size>1</size>, please help here.

I tried the below XPath in Driver's local variable as String but got an error.

$lv-Result/*[local-name()="soapenv:Envelope"]/*[local-name()="soapenv:Body"]/queryAllResponse/result/size/text()

I am using IDM 4.7.3.

Parents Reply
  • 0   in reply to 

    In Designer, you could flip to the XMLview, in the <policy> node, add this text inside the node like:
    <policy xmlns:sf="urn:sobject.partner.soap.sforce.com"?

    Or you could click the Namespace button on the Policy page where you use this XPATH expression (upper right, it is next to the Simulate button)

    And define the first field as sf and then the second field as urn:sobject.partner.soap.sforce.com

Children
  • Verified Answer

    +1   in reply to   

    Here is a screen shot, for a POlicy editor page, I clicked on the Namespace icon, upper right, (see where my arrow is pointing) and moved the Namespace Editor underneath for a smaller screen shot.

    In the prefix, put sf

    In the URI put the urn:sobject.partner.soap.sforce.com value

    If you check the <policy> node, before and after the change, you will see it gets appended the full

    xmlns:sf="urn:sobject.partner.soap.sforce.com" value.

    Both ways are the same, just different approaches.