Пример #1
0
        private static Response parseResponse(string str)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.LoadXml(str);
            }
            catch
            {
                return new ResponseBadResponse();
            }

            string id = doc.SelectSingleNode("response/id").InnerText;

            Response resp = new Response(id);

            foreach (XmlNode node in doc.SelectNodes("response/*"))
                resp.AddProperty(node.Name, node.InnerXml);

            resp.OkStatus = (resp.TryGetPropertyValue("status") == "ok");

            return resp;
        }