0

I want to create a List of strings in C#. These strings all come from this one:

<Functie><Titel><![CDATA[voorzitter]]></Titel></Functie><Functie><Titel><![CDATA[planner]]></Titel></Functie><Functie><Titel><![CDATA[barman1]]></Titel></Functie><Functie><Titel><![CDATA[barman2]]></Titel></Functie><Functie><Titel><![CDATA[barman3]]></Titel></Functie>

This string come from a soap respons. Here is my request:

using (Stream stream = request.GetRequestStream())
        {
            soapEnvelopeXml.Save(stream);
        }
        using (WebResponse response = request.GetResponse())
        {
            using (StreamReader rd = new StreamReader(response.GetResponseStream()))
            {
                string soapResult = rd.ReadToEnd();
                string toBeSearched = "<tns:VoorkeurListResponse>";
                int ix = soapResult.IndexOf(toBeSearched);

                if (ix != -1)
                {
                    string code = soapResult.Substring(ix + toBeSearched.Length);
                    code = code.Substring(0, code.IndexOf("</tns:VoorkeurListResponse>"));
                    List = code;
                    System.Diagnostics.Debug.WriteLine(List);

                    System.Diagnostics.Debug.WriteLine(soapResult);
                }
            }
        }
    }

I want to get the data that is between the brackets, so my List would be: voorzitter, planner, barman1, barman2, barman3.

Could somebody help me with this problem?

atze de groot
  • 53
  • 1
  • 9

0 Answers0