Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    XML, Soap and XPATH

    Hi,

    I am working with some XML, not really technically inclined and been trying to figure this out from reading various sources on the internet but getting nowhere fast.

    I have the below XML:

    Code:
    <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <soap:Header>
          <XXXSoapHeader xmlns="http://XXX.com/optima/webservices">
             <AuthenticationString>?</AuthenticationString>
          </XXXSoapHeader>
       </soap:Header>
       <soap:Body>
          <SubmitMultipleCalcMarginRequestResponse xmlns="http://XXX.com/optima/webservices">
             <SubmitMultipleCalcMarginRequestResult>
                <TaskExecutionSubmitInfo>
                   <taskExecutionId>74457</taskExecutionId>
                   <description>Calc LIVE BROKER margin : Account WebServiceTest_Account1(435) : Business Date (12-Feb-2007)</description>
                </TaskExecutionSubmitInfo>
                <TaskExecutionSubmitInfo>
                   <taskExecutionId>74458</taskExecutionId>
                   <description>Calc LIVE BROKER margin : Account WebServiceTest_Account2(436) : Business Date (12-Feb-2007)</description>
                </TaskExecutionSubmitInfo>
             </SubmitMultipleCalcMarginRequestResult>
          </SubmitMultipleCalcMarginRequestResponse>
       </soap:Body>
    </soap:Envelope>
    And have been using the below to extract nodes:

    Code:
    //*[name() = 'taskExecutionId']
    Which returns:

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <root xmlns="http://XXX.com/optima/webservices">
      <taskExecutionId>74457</taskExecutionId>
      <taskExecutionId>74458</taskExecutionId>
    </root>
    But what can I do if I want to return just the second taskExecutionId? I have tried appending with a [n] but this doesn't to work. Any ideas?

  • #2
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I got a response on Stack Overflow if anybody is every interested:

    http://stackoverflow.com/questions/1...98125#14398125


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •