如何使用特定的namesapce读取此响应xml的内部节点。

时间:2017-05-26 10:05:44

标签: c# xml .net-core xml-namespaces

<?xml version="1.0" encoding="UTF-8"?>
-<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
 <soapenv:Header/>
-<soapenv:Body>
     -<ns:processRequestResponse 
       xmlns:ns="http://inquiry.wrapper.ext.xface.fc.ofss.com">
     -<ns:return xsi:type="ax290:XfacePassbookTxnInqResponseDTO" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xmlns:ax298="http://enumeration.infra.fc.ofss.com/xsd" 
      xmlns:ax297="http://exception.infra.fc.ofss.com/xsd" 
     xmlns:ax296="http://transaction.entity.fc.ofss.com/xsd" 
     xmlns:ax292="http://error.validation.infra.fc.ofss.com/xsd" 
     xmlns:ax291="http://common.dto.xface.fc.ofss.com/xsd" 
     xmlns:ax290="http://dto.ext.xface.fc.ofss.com/xsd" xmlns:ax288="http://context.app.fc.ofss.com/xsd" xmlns:ax2113="http://util.java/xsd" xmlns:ax2108="http://enumeration.fc.ofss.com/xsd" xmlns:ax2106="http://datatype.fc.ofss.com/xsd" xmlns:ax2105="http://global.entity.fc.ofss.com/xsd">    
       <ax291:postingDate>20170523</ax291:postingDate>    

       -<ax291:transactionStatus xsi:type="ax296:TransactionStatus">
        <ax296:FCYHangeHandlingApplied>false</ax296:FCYHangeHandlingApplied>
           <ax296:errorCode>0</ax296:errorCode>
          -<ax296:extendedReply xsi:type="ax297:ExtendedReply">
          <ax297:messages xsi:nil="true"/>
          </ax296:extendedReply>
         <ax296:externalReferenceNo>170523134807</ax296:externalReferenceNo>
         <ax296:isOverriden>false</ax296:isOverriden>
          <ax296:isServiceChargeApplied>false</ax296:isServiceChargeApplied>
        <ax296:memo xsi:nil="true"/>
        <ax296:replyCode>0</ax296:replyCode>
       <ax296:replyText xsi:nil="true"/>
       <ax296:spReturnValue>0</ax296:spReturnValue>
       <ax296:userReferenceNumber xsi:nil="true"/>
       <ax296:validationErrors xsi:nil="true"/>
  </ax291:transactionStatus>     
        <ax290:accountTitle>M/S GRAND HOLIDAYS</ax290:accountTitle>
        <ax290:currentPassbookNo>3</ax290:currentPassbookNo>   
        <ax290:lastPassbookBalance>7420.55</ax290:lastPassbookBalance>    
        <ax290:lineNumber>30</ax290:lineNumber>    
        <ax290:openingBalance>0.00</ax290:openingBalance>
-<ax290:passbookTransactionDetails 
  xsi:type="ax290:PassbookTransactionDetails">    
<ax291:postingDate xsi:nil="true"/>    
<ax291:transactionStatus xsi:nil="true"/>    
<ax290:balanceAmount>6420.55</ax290:balanceAmount>    
<ax290:countRows>16</ax290:countRows>    
<ax290:debitCreditFlag>D</ax290:debitCreditFlag>    
<ax290:depTxnAmount xsi:nil="true"/>    
<ax290:depositNumber>0</ax290:depositNumber>    
<ax290:narration>bill of kirana Dr - 0510111000</ax290:narration>    
<ax290:originalDepositNumber>0</ax290:originalDepositNumber>    
<ax290:referenceChequeNumber>000000000053</ax290:referenceChequeNumber>    
<ax290:serialNumber>1</ax290:serialNumber>    
<ax290:tellerId>33257</ax290:tellerId>    
<ax290:transactionAmount>1000.00</ax290:transactionAmount>    
<ax290:transactionAmountInTxnCcy>1000.0</ax290:transactionAmountInTxnCcy>    
<ax290:transactionBranchCode>51</ax290:transactionBranchCode>    
<ax290:transactionDate>20/05/17</ax290:transactionDate>    
<ax290:transactionMnemonic>1006</ax290:transactionMnemonic>    
<ax290:transactionPostingDate>04/04/17</ax290:transactionPostingDate>    
<ax290:transactionRefNumber xsi:nil="true"/>    
<ax290:transactionType>FTD</ax290:transactionType>    
<ax290:withDrTxnAmount>1000</ax290:withDrTxnAmount>    
</ax290:passbookTransactionDetails>
-<ax290:passbookTransactionDetails 
 xsi:type="ax290:PassbookTransactionDetails">    
<ax291:postingDate xsi:nil="true"/>    
<ax291:transactionStatus xsi:nil="true"/>    
<ax290:balanceAmount>8476.55</ax290:balanceAmount>    
<ax290:countRows>16</ax290:countRows>    
<ax290:debitCreditFlag>C</ax290:debitCreditFlag>    
<ax290:depTxnAmount>2056</ax290:depTxnAmount>    
<ax290:depositNumber>0</ax290:depositNumber>    
<ax290:narration>002010100022341:CASA-CASA Val</ax290:narration>    
<ax290:originalDepositNumber>0</ax290:originalDepositNumber>    
<ax290:referenceChequeNumber>33258</ax290:referenceChequeNumber>    
<ax290:serialNumber>2</ax290:serialNumber>    
<ax290:tellerId>33258</ax290:tellerId>    
<ax290:transactionAmount>2056.00</ax290:transactionAmount>    
<ax290:transactionAmountInTxnCcy>2056.0</ax290:transactionAmountInTxnCcy>    
<ax290:transactionBranchCode>51</ax290:transactionBranchCode>    
<ax290:transactionDate>20/05/17</ax290:transactionDate>    
<ax290:transactionMnemonic>1095</ax290:transactionMnemonic>    
    <ax290:transactionPostingDate>04/04/17</ax290:transactionPostingDate>    
     <ax290:transactionRefNumber xsi:nil="true"/>    
      <ax290:transactionType>VFC</ax290:transactionType>    
       <ax290:withDrTxnAmount xsi:nil="true"/>    
     </ax290:passbookTransactionDetails>
</ns:return> 
</ns:processRequestResponse> 
</soapenv:Body> 
</soapenv:Envelope>

上面的xml实际上太冗长了。但是我们需要找出如何从整个xml文件中提取余额金额 例如: -

<ax290:balanceAmount>6420.55</ax290:balanceAmount>

我们只需要来自子节点的值6420.55。 为了更清晰,我添加了一张图片

https://i.stack.imgur.com/m6k87.png

0 个答案:

没有答案