前端之家收集整理的这篇文章主要介绍了
XML遍历节点内部list,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
XmlDocument doc = new XmlDocument(); doc.LoadXml(sHtmlText); string s1 = doc.SelectNodes("signType").ToString(); IList<OrderMsgModel> dtos = new List<OrderMsgModel>(); ///////////验证签名 ////////////////////////////// //////////验签通过
获取list列表 // XmlNodeList list = doc.GetElementsByTagName("recordList"); XmlNode xn = doc.SelectSingleNode("queryResult"); XmlNodeList xnl = xn.ChildNodes; foreach (XmlNode xnf in xnl) { XmlElement xe = (XmlElement)xnf; string ss = xe.GetAttribute("inputCharset");//
显示属性值 string s2 = xe.GetAttribute("version"); if (xnf.Name == "recordList") { XmlNodeList xnf1 = xe.ChildNodes; foreach (XmlNode xn2 in xnf1) { XmlElement xee = (XmlElement)xnf; XmlNodeList realNodes = xee.ChildNodes; foreach (XmlNode realNode in realNodes) { XmlElement xrealNode = (XmlElement)realNode; XmlNodeList xrealList = xrealNode.ChildNodes; foreach (XmlNode nodess in xrealList) { string orders = nodess.Name; } } } } }
原文链接:https://www.f2er.com/xml/297850.html