0

I'm posting and HTTP request to an API that gives a response formatted in the following way:

<?xml version="1.0" encoding="UTF-8"?>
<FanvilConfiguration cmd="get">
    <RetCode>0</RetCode>
    <info>
        <item> accessList.1.ID=1107275212 </item>
    </info>
</FanvilConfiguration>

Basically, I'm just looking into a list and retrieving people's IDs, and need to check if they're null or invalid. I'm getting the response using

var response1 = (HttpWebResponse)myWebRequest.GetResponse();
response = new StreamReader(response1.GetResponseStream()).ReadToEnd();

How can I retrieve the ID from the response body and store it in a variable?

  • Please edit your question and add in the code that demonstrates your best attempt at parsing the xml yourself. There are a lot of tutorials and demos on how to do this. What problem are you encountering when you try? – devlin carnate May 10 '22 at 18:30
  • Side point: `response1` and `response` need to be disposed with `using` – Charlieface May 10 '22 at 18:51

0 Answers0