页面内容如下:<?xml version="1.0" encoding="gb2312"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>查看英才简历库简历 | 智聘系统</title>
<style rel="stylesheet" type="text/css">
.resume_mail .itemName a.top{display:none}
</style>
<link href="http://image.mychinahr.com/a/campus09/styles/view/view_old0.css" rel="stylesheet" type="text/css" />
<link href="http://image.mychinahr.com/a/campus09/styles/view.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="resume_mail">
<div class="ResumeView">
<div class="view_nav">
<div class="flt_l"></div>
<div class="flt_r">
简历编号:4000000010133335|
更新日期:2010年9月15日
<img src="http://image.mychinahr.com/a/ehr6/images/icon_ydl.gif" alt="30天内登录过" />
<img src="http://image.mychinahr.com/a/ehr6/images/icon_jlgx.gif" alt="30天内更新过简历" />
</div>
</div>
<h3>
<!--name标签 不要删除-->
<name>
James Ryan
</name>
</h3>
<div class="summaryLine">
<span>机械制造·机电·重工</span>
<span>|</span>
<span>销售部副经理,兼高级商务经理,合同经理</span>
<span>|</span>
<span>21年</span>
<span>|</span>
<span>本科</span>
<span>|</span>
<span>北京</span>
</div>
我想读取:姓名,职位,年龄信息,不知道C#代码应该怎么写,请高手指教
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>查看英才简历库简历 | 智聘系统</title>
<style rel="stylesheet" type="text/css">
.resume_mail .itemName a.top{display:none}
</style>
<link href="http://image.mychinahr.com/a/campus09/styles/view/view_old0.css" rel="stylesheet" type="text/css" />
<link href="http://image.mychinahr.com/a/campus09/styles/view.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div class="resume_mail">
<div class="ResumeView">
<div class="view_nav">
<div class="flt_l"></div>
<div class="flt_r">
简历编号:4000000010133335|
更新日期:2010年9月15日
<img src="http://image.mychinahr.com/a/ehr6/images/icon_ydl.gif" alt="30天内登录过" />
<img src="http://image.mychinahr.com/a/ehr6/images/icon_jlgx.gif" alt="30天内更新过简历" />
</div>
</div>
<h3>
<!--name标签 不要删除-->
<name>
James Ryan
</name>
</h3>
<div class="summaryLine">
<span>机械制造·机电·重工</span>
<span>|</span>
<span>销售部副经理,兼高级商务经理,合同经理</span>
<span>|</span>
<span>21年</span>
<span>|</span>
<span>本科</span>
<span>|</span>
<span>北京</span>
</div>
我想读取:姓名,职位,年龄信息,不知道C#代码应该怎么写,请高手指教
// James Ryan
private static void TestRegex26()
{
string html = @"<?xml version=""1.0"" encoding=""gb2312""?>
<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Transitional//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"">
<html xmlns=""http://www.w3.org/1999/xhtml"">
<head>
<title>查看英才简历库简历 | 智聘系统</title>
<style rel=""stylesheet"" type=""text/css"">
.resume_mail .itemName a.top{display:none}
</style>
<link href=""http://image.mychinahr.com/a/campus09/styles/view/view_old0.css"" rel=""stylesheet"" type=""text/css"" />
<link href=""http://image.mychinahr.com/a/campus09/styles/view.css"" type=""text/css"" rel=""stylesheet"" />
</head>
<body>
<div class=""resume_mail"">
<div class=""ResumeView"">
<div class=""view_nav"">
<div class=""flt_l""></div>
<div class=""flt_r"">
简历编号:4000000010133335|
更新日期:2010年9月15日
<img src=""http://image.mychinahr.com/a/ehr6/images/icon_ydl.gif"" alt=""30天内登录过"" />
<img src=""http://image.mychinahr.com/a/ehr6/images/icon_jlgx.gif"" alt=""30天内更新过简历"" />
</div>
</div>
<h3>
<!--name标签 不要删除-->
<name>
James Ryan
</name>
</h3>
<div class=""summaryLine"">
<span>机械制造·机电·重工</span>
<span>|</span>
<span>销售部副经理,兼高级商务经理,合同经理</span>
<span>|</span>
<span>21年</span>
<span>|</span>
<span>本科</span>
<span>|</span>
<span>北京</span>
</div>
";
Match m = Regex.Match(html, @"(?ni)<name>\s*(?<name>.+?)\s*</name>([^>]+>){7}(?<position>[^<]+)([^>]+>){4}(?<age>\d+)");
Console.WriteLine("姓名:" + m.Groups["name"].Value);
Console.WriteLine("职位:" + m.Groups["position"].Value);
Console.WriteLine("年龄:" + m.Groups["age"].Value); }
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse respone = (HttpWebResponse)request.GetResponse();
Stream resStream = respone.GetResponseStream();
StreamReader reader = new StreamReader(resStream, Encoding.Default);
string resphtml = reader.ReadToEnd();
resStream.Close(); MatchCollection mcGoods = Regex.Matches(resphtml,@"(?<=<name>).*(?=</name>)");
System.Collections.IEnumerator goodsEnumerator = mcGoods.GetEnumerator();这是读取名字的,其他的换下 正则就可以了