XML data into comma seperated string

I call a web service and get following XML (see code).

I need to know how do I convert the data into:

7369, 8834

In other words, If I get results, I need to convert result into comma separated string so that I can pass it to query string in URL

- <NewDataSet>
- <Table>
- <Table>

Open in new window

Who is Participating?
aprestoConnect With a Mentor Commented:
Something like this?
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
        System.Xml.XmlNodeList nodeList = doc.GetElementsByTagName("Table");
        string values = "";
        foreach (System.Xml.XmlNode tableNode in nodeList)
            System.Xml.XmlNode numNode = tableNode.SelectSingleNode("ext_user_id");
            values = numNode.InnerText + ",";
        values += values.Substring(0, values.Length - 1);

Open in new window

immtracAuthor Commented:
Thanks for your reply. When I call web service  I don't know if I get 10 ids, 100 ids or nothing.

So I can not  hard code the XML.

Also is there way that we can use split() function?
I was only hardcoding the xml for demonstration purposes, all you need to do is put the string returned by the webservice into it. This method will work for 10 or 100 nodes in an xml string.
Why would you want to use split, the XmlDocument class is there for a reason, lol
immtracAuthor Commented:
What I am getting is 8834,8834

While is should be 7369,8834.
immtracAuthor Commented:
Never mind. I got it.

Thanks for ur help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.