I am making an API call to a service, and receiving an big XML back. I am looking to grab the unique info that is attached to a header, but cannot find out how to do it.
XML call -
<InvDetailRequest>
<InvDetailRequestHeader invDate="2023-06-14T18:51:50-04:00" invID="IN305">
I want to grab the InvDate, and the InvID, but do not know how.
In another part of my code, I am using this loop to grab all the ID's attached. But grabbing the singleNode inner text does not work.
XmlDocument doc = context.Data.ToXmlDocument();
XmlNodeList nodes = doc.DocumentElement.SelectNodes("/DataRequest/Source/AttachmentInfo/Attachment");
foreach (XmlNode node in nodes)
{
//Grab single node here - node.SelectSingleNode("ID").InnerText
}
I was able to get some ouput with
doc.DocumentElement.SelectSingleNode("//InvDetailRequest").InnerXml)
But I do not know how to single down the specific InvID variable to assign elsewhere.