码迷,mamicode.com
首页 > 其他好文 > 详细

获取xml中所有某标签的内容

时间:2017-03-31 15:58:46      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:匹配   lis   ons   ++   str   标签   mat   内容   count   

string regStr = "<A>([\\w\\W]+?)</A>";//匹配A标签正则表达式
Regex tmpReg = new Regex(regStr, RegexOptions.Compiled);
MatchCollection matcheList = tmpReg.Matches(xml);
if (matcheList.Count != 0)
{
 for (int i = 0; i < matcheList.Count; i++)
  {
       list.Add(matcheList[i].Groups[0].Value);
  }
}

 

获取xml中所有某标签的内容

标签:匹配   lis   ons   ++   str   标签   mat   内容   count   

原文地址:http://www.cnblogs.com/xiaoheihei/p/6651411.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!