I am very new to c#. my project to send request in xml format to broker side which i have done it.
I am trying to handle the response which again comes in xml format. Below is the format of the response. My question is how to find the tag names that is LocateRequest
and LocateStatusApproved
and then all those values inside that. I tried below code but I am hardcoding the tag name which i don't want to do that.
XmlNodeList nodeList = xmlDoc.GetElementsByTagName("LocateStatusApproved");
foreach (XmlNode node in nodeList)
{
App.logger.LogLine("inside for loop");
string quant = node.Attributes["approvedQuantity"].Value;
App.logger.LogLine("quant value: {0}", (quant));
}
Xml response file looks like below
<LocateResponse xmlns="http://www.omnilocate.com/StockLoan/LocateService">
<Locates>
<Locate>
<LocateRequest acceptManualApproval="true" acceptPartial="true" securityId="IBM" securityIdentifierType="TICKER" market="US" requestedQuantity="10" requestorReference="98" cashOrSwap="CASH" />
<LocateStatusApproved approvedTimeUTC="2020-12-06T18:31:18.214Z" locateId="158705132" approvedQuantity="10" rate="-108.75" rateIndicator="REBATE" />
</Locate>
</Locates>
<Disclaimer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
</LocateResponse>