0
我正在使用一些XML,並非真正在技術上傾向於嘗試從互聯網上的各種源讀取數據,但無法快速獲取。具有多個節點實例的XML,Soap和XPATH查詢
我有下面的XML:
<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>
而且一直在使用下面提取的節點信息:
//*[name() = 'taskExecutionId']
將返回:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://XXX.com/optima/webservices">
<taskExecutionId>74457</taskExecutionId>
<taskExecutionId>74458</taskExecutionId>
</root>
但又能怎樣我這樣做,如果我想只返回第二個taskExecutionId?或者第一個?我嘗試追加[n],但這不起作用。有任何想法嗎?
太棒了,謝謝 –