When I send request I will get like this response:
<?xml version="1.0" encoding="UTF-8"?>
<response result="0">
<check result="0">
<extras PRV_TXN_ID="538659" disp1="text1" disp2="text2" disp3="text3"/>
</check>
</response>
I want to show in console list of disp attributes. Quantity of disp attributes are unknown, depends on requests. Sometimes there will be disp1.....disp8 . Here in this response there 3 disp' attributes and before getting response I didn't know how many are they. How to do that?
Here my Parsing:
public static XmlDocument postXMLData(string xml)
{
var request = (HttpWebRequest)WebRequest.Create(Requests.url);
byte[] bytes;
bytes = System.Text.Encoding.ASCII.GetBytes(xml);
request.ContentType = "text/xml; encoding='utf-8'";
request.ContentLength = bytes.Length;
request.Method = "POST";
Stream requestStream = request.GetRequestStream();
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
HttpWebResponse response;
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode == HttpStatusCode.OK)
{
using (var streamReader = new StreamReader(response.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
var result = new XmlDocument();
result.LoadXml(responseText);
return result;
}
}
throw new Exception("что то не так");
}