public WBAccessReplyResponse(string xmlFile) { if (xmlFile!=string.Empty) { XmlDocument xmldoc = new XmlDocument(); xmldoc.LoadXml(xmlFile); XmlNode xnroot = xmldoc.SelectSingleNode("comment"); SinaComment s = SinaModelFactory.CreateComment(xnroot); s.user = SinaModelFactory.CreateUser(xnroot.SelectSingleNode("user")); s.status = SinaModelFactory.CreateStatus(xnroot.SelectSingleNode("status")); s.reply_comment = SinaModelFactory.CreateReply_comment(xnroot.SelectSingleNode("reply_comment")); s.reply_comment.user = SinaModelFactory.CreateUser(xnroot.SelectSingleNode("reply_comment").SelectSingleNode("user")); s.status.user = SinaModelFactory.CreateUser(xnroot.SelectSingleNode("status").SelectSingleNode("user")); s.status.retweeted_status = SinaModelFactory.CreateRetweeted_status(xnroot.SelectSingleNode("status").SelectSingleNode("user").SelectSingleNode("retweeted_status")); s.status.retweeted_status.user = SinaModelFactory.CreateUser(xnroot.SelectSingleNode("status").SelectSingleNode("user").SelectSingleNode("retweeted_status").SelectSingleNode("user")); s.user.status = SinaModelFactory.CreateStatus(xnroot.SelectSingleNode("user").SelectSingleNode("status")); s.user.status.retweeted_status = SinaModelFactory.CreateRetweeted_status(xnroot.SelectSingleNode("user").SelectSingleNode("status").SelectSingleNode("retweeted_status")); s.user.status.retweeted_status.user = SinaModelFactory.CreateUser(xnroot.SelectSingleNode("user").SelectSingleNode("status").SelectSingleNode("retweeted_status").SelectSingleNode("user")); this._comment = s; } }
public static SinaComment CreateComment(XmlNode xnComment) { SinaComment s = null; if (xnComment != null) { s = new SinaComment(); // <created_at>Mon Dec 13 14:55:05 +0800 2010</created_at> s.created_at = xnComment.SelectSingleNode("created_at").InnerText; //<id>4288554507</id> s.id = Convert.ToInt64(xnComment.SelectSingleNode("id").InnerText); //<text>abcedf</text> s.text = xnComment.SelectSingleNode("text").InnerText; //s._thrumbnail_pic = xnComment.SelectSingleNode("thrumbnail_pic") != null ? xnComment.SelectSingleNode("thrumbnail_pic").InnerText : null; //s._original_pic = xnComment.SelectSingleNode("original_pic") != null ? xnComment.SelectSingleNode("original_pic").InnerText : null; //s._bmiddle_pic = xnComment.SelectSingleNode("bmiddle_pic") != null ? xnComment.SelectSingleNode("bmiddle_pic").InnerText : null; } return s; }