<?xml version="1.0" encoding="utf-8" ?> <TRANS_NET> <REQUEST_ID>0</REQUEST_ID> <REQUEST_DATE>0000-000</REQUEST_DATE> <RESPONSE_CODE>003</RESPONSE_CODE> <RESPONSE_REASON> <ERROR> <ERROR_CODE>243</ERROR_CODE> <ERROR_CODE>003</ERROR_CODE> <ERROR_CODE>040</ERROR_CODE> <ERROR_CODE>017</ERROR_CODE> <ERROR_CODE>039</ERROR_CODE> </ERROR> </RESPONSE_REASON> </TRANS_NET>
using (System.Xml.XmlReader xmlReader = System.Xml.XmlReader.Create(strReader)) { while (xmlReader.Read()) { if (xmlReader.NodeType == System.Xml.XmlNodeType.Element) { //if (xmlReader.Name == "TRANS_NET") //{ switch (xmlReader.Name) { case "TRANS_NET": plainText += "Response \r\n"; break; case "REQUEST_ID": plainText += String.Format("Request ID = {0} \r\n", xmlReader.Value); break; case "REQUEST_DATE": plainText += String.Format("Request Date = {0} \r\n", xmlReader.Value); break; case "RESPONSE_CODE": plainText += String.Format("Response Code = {0} \r\n", xmlReader.Value); break; case "RESPONSE_REASON": plainText += "An Error Was Encountered \r\n"; break; case "ERROR": plainText += "Error Codes List \r\n"; break; case "ERROR_CODE": if (xmlReader.Read()) { plainText += String.Format("Error Code = {0} \r\n", xmlReader.Value); } break; default: plainText += "\r\n"; break; } //} } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)