Exemple #1
0
        public static List<Users> GetUsers (string url, string request)
        {
            String answerBody = Pattern(url, request, true);

            XmlDocument doc = new XmlDocument();
            doc.LoadXml(answerBody);
            List<Users> UserList = new List<Users>();

            XmlNodeList xnList = doc.SelectNodes("/response/user");
            foreach (XmlNode xn in xnList)
            {
                string name = xn["name"].InnerText;
                int id = Int32.Parse( xn["id"].InnerText);
                Users finduser = new Users (name,id );
                UserList.Add(finduser);
            }
            return UserList;
        }
Exemple #2
0
        public static List<Users> SearchUserList(string url)
        {
            String answerBody = Pattern(url, null, false);

            if (answerBody != "<response>\r\n</response>")
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(answerBody);

                List<Users> UserList = new List<Users>();

                XmlNodeList xnList = doc.SelectNodes("/response/user");
                foreach (XmlNode xn in xnList)
                {
                    string name = xn["name"].InnerText;
                    int id = Int32.Parse(xn["id"].InnerText);
                    Users requestuser = new Users(name, id);
                    UserList.Add(requestuser);
                }
                return UserList;
            }
            else
            {
                return null;
            }
        }