我需要顯示processingStatus和每個字段節點值及其相應的以下XML名稱。XML屬性c#
<?xml version="1.0" encoding="UTF-8"?>
<T24 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.temenos.com/T24/OFSML/130" xsi:schemaLocation="http://www.temenos.com/T24/OFSML/130 ofsml13.xsd">
<serviceResponse>
<ofsTransactionProcessed application="FUNDS.TRANSFER" function="INPUT" operation="VALIDATE" processingStatus="OK" version="BOOK.TRAN.VAL.MCB">
<transactionId>FT15056T2QLP</transactionId>
<field mv="1" name="TRANSACTION.TYPE" sv="1">AC</field>
<field mv="1" name="CURRENCY.MKT.DR" sv="1">1</field>
<field mv="1" name="DEBIT.CURRENCY" sv="1">USD</field>
<field mv="1" name="DEBIT.AMOUNT" sv="1">125.00</field>
<field mv="1" name="DEBIT.VALUE.DATE" sv="1">20150225</field>
</ofsTransactionProcessed>
</serviceResponse>
</T24>
任何人都可以幫助我嗎? 我的代碼: 編輯的代碼:
XmlTextReader reader = new XmlTextReader("XML03.xml");
Console.WriteLine(reader.Attributes["processingStatus"].Value);
while (reader.Read())
{
Console.WriteLine(reader.Value);
}
Console.ReadLine();
你有什麼企圖?任何搜索努力? – Steve
@Steve yes請參閱編輯 – velvt
現在請描述代碼有什麼問題以及輸出/異常 – Steve