遇到的很头痛的问题,高手请看, 问题描述:
例子(一),可以正确的将html解析为xml;
例子(二),不能解析 下面是代码部分:
(一)能正确运行的例子 a,正则部分
<!--
广西 No.1 begin
-->
<PortalRegex Name="GuangXi">
<Regex> <![CDATA[
<input[^> ]*name\s*=\s*"hiddentonecode"
[^> ]*value\s*=\s*"(? <hiddentonecodes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonename"
[^> ]*value\s*=\s*"(? <hiddentonenames> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddensinger"
[^> ]*value\s*=\s*"(? <hiddensingers> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentoneinfo"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenprice"
[^> ]*value\s*=\s*"(? <hiddenprices> [^\s]*)"[^> ]*>
\s*
<!--[^> ]*--> \s*
<input[^> ]*name\s*=\s*"hiddentonevalidday"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenupdatetime"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddendownloadtimes"
[^> ]*value\s*=\s*"(? <hiddendownloadtimes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenleafdirindex"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*value\s*=\s*"(? <hiddenspnames> [^\s]*)"[^> ]*>
]]> </Regex>
</PortalRegex>
<!--
================================================
广西 end
================================================
--> b,html部分
<!--
广西 No.1 begin
-->
<input type = "hidden" name = "hiddentonecode" value = "621985000000003028">
<input type = "hidden" name = "hiddentonename" value = "西界(情人版)">
<input type = "hidden" name = "hiddensinger" value = "林俊杰">
<input type = "hidden" name = "hiddentoneinfo" value = "null">
<input type = "hidden" name = "hiddenprice" value = "3.00">
<!--新增铃音有效期 樊辉 2003-11-25 -->
<input type = "hidden" name = "hiddentonevalidday" value = "2008-08-25 ">
<input type = "hidden" name = "hiddenupdatetime" value = "2008-01-02 17:57:31">
<input type = "hidden" name = "hiddendownloadtimes" value = "27">
<input type = "hidden" name = "hiddenleafdirindex" value = "">
<input type="hidden" name = "hiddenspname" value="北京空中信使">
<!--
================================================
广西 end
================================================
--> (二)失败的例子 a,正则部分
<!--
河北 begin
-->
<PortalRegex Name="HeBei">
<Regex> <![CDATA[
<input[^> ]*name\s*=\s*"hiddentonecode"
[^> ]*value\s*=\s*"(? <hiddentonecodes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonename"
[^> ]*value\s*=\s*"(? <hiddentonenames> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*value\s*=\s*"(? <hiddenspnames> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddensinger"
[^> ]*value\s*=\s*"(? <hiddensingers> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentoneinfo"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenprice"
[^> ]*value\s*=\s*"(? <hiddenprices> [^\s]*)"[^> ]*>
\s*
<!--[^> ]*--> \s*
<input[^> ]*name\s*=\s*"hiddenupdatetime"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddendownloadtimes"
[^> ]*value\s*=\s*"(? <hiddendownloadtimes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenleafdirindex"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonevalidday"
[^> ]*>
]]>
</Regex>
</PortalRegex>
<!--
河北 end
--> b,html部分 <!--
河北 begin
-->
<input type = "hidden" name = "hiddentonecode" value = "5055705">
<input type = "hidden" name = "hiddentonename" value = "你到底爱谁(高潮经典剪接版)">
<input type = "hidden" name = "hiddenspname" value = "龙腾阳光">
<input type = "hidden" name = "hiddensinger" value = "亮亮">
<input type = "hidden" name = "hiddentoneinfo" value = "">
<input type = "hidden" name = "hiddenprice" value = "2.00">
<input type = "hidden" name = "hiddenupdatetime" value = "2007-12-05">
<input type = "hidden" name = "hiddendownloadtimes" value = "354258">
<input type = "hidden" name = "hiddenleafdirindex" value = "null">
<input type = "hidden" name = "hiddenspname" value="龙腾阳光">
<input type="hidden" name="hiddentonevalidday" value="2008-12-14">
<!--
河北 end
-->
例子(一),可以正确的将html解析为xml;
例子(二),不能解析 下面是代码部分:
(一)能正确运行的例子 a,正则部分
<!--
广西 No.1 begin
-->
<PortalRegex Name="GuangXi">
<Regex> <![CDATA[
<input[^> ]*name\s*=\s*"hiddentonecode"
[^> ]*value\s*=\s*"(? <hiddentonecodes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonename"
[^> ]*value\s*=\s*"(? <hiddentonenames> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddensinger"
[^> ]*value\s*=\s*"(? <hiddensingers> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentoneinfo"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenprice"
[^> ]*value\s*=\s*"(? <hiddenprices> [^\s]*)"[^> ]*>
\s*
<!--[^> ]*--> \s*
<input[^> ]*name\s*=\s*"hiddentonevalidday"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenupdatetime"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddendownloadtimes"
[^> ]*value\s*=\s*"(? <hiddendownloadtimes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenleafdirindex"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*value\s*=\s*"(? <hiddenspnames> [^\s]*)"[^> ]*>
]]> </Regex>
</PortalRegex>
<!--
================================================
广西 end
================================================
--> b,html部分
<!--
广西 No.1 begin
-->
<input type = "hidden" name = "hiddentonecode" value = "621985000000003028">
<input type = "hidden" name = "hiddentonename" value = "西界(情人版)">
<input type = "hidden" name = "hiddensinger" value = "林俊杰">
<input type = "hidden" name = "hiddentoneinfo" value = "null">
<input type = "hidden" name = "hiddenprice" value = "3.00">
<!--新增铃音有效期 樊辉 2003-11-25 -->
<input type = "hidden" name = "hiddentonevalidday" value = "2008-08-25 ">
<input type = "hidden" name = "hiddenupdatetime" value = "2008-01-02 17:57:31">
<input type = "hidden" name = "hiddendownloadtimes" value = "27">
<input type = "hidden" name = "hiddenleafdirindex" value = "">
<input type="hidden" name = "hiddenspname" value="北京空中信使">
<!--
================================================
广西 end
================================================
--> (二)失败的例子 a,正则部分
<!--
河北 begin
-->
<PortalRegex Name="HeBei">
<Regex> <![CDATA[
<input[^> ]*name\s*=\s*"hiddentonecode"
[^> ]*value\s*=\s*"(? <hiddentonecodes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonename"
[^> ]*value\s*=\s*"(? <hiddentonenames> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*value\s*=\s*"(? <hiddenspnames> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddensinger"
[^> ]*value\s*=\s*"(? <hiddensingers> [^"]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentoneinfo"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenprice"
[^> ]*value\s*=\s*"(? <hiddenprices> [^\s]*)"[^> ]*>
\s*
<!--[^> ]*--> \s*
<input[^> ]*name\s*=\s*"hiddenupdatetime"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddendownloadtimes"
[^> ]*value\s*=\s*"(? <hiddendownloadtimes> [^\s]*)"[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenleafdirindex"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddenspname"
[^> ]*>
\s*
<input[^> ]*name\s*=\s*"hiddentonevalidday"
[^> ]*>
]]>
</Regex>
</PortalRegex>
<!--
河北 end
--> b,html部分 <!--
河北 begin
-->
<input type = "hidden" name = "hiddentonecode" value = "5055705">
<input type = "hidden" name = "hiddentonename" value = "你到底爱谁(高潮经典剪接版)">
<input type = "hidden" name = "hiddenspname" value = "龙腾阳光">
<input type = "hidden" name = "hiddensinger" value = "亮亮">
<input type = "hidden" name = "hiddentoneinfo" value = "">
<input type = "hidden" name = "hiddenprice" value = "2.00">
<input type = "hidden" name = "hiddenupdatetime" value = "2007-12-05">
<input type = "hidden" name = "hiddendownloadtimes" value = "354258">
<input type = "hidden" name = "hiddenleafdirindex" value = "null">
<input type = "hidden" name = "hiddenspname" value="龙腾阳光">
<input type="hidden" name="hiddentonevalidday" value="2008-12-14">
<!--
河北 end
-->
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货