StreamReader sr = new StreamReader(Server.MapPath("ParkXML/" + Request.QueryString["tickArr"].ToString() + ".xml"), System.Text.Encoding.Default);
String strXml = sr.ReadToEnd();
sr.Close();
strXml.Replace("$parkname$", parkname); //这里面的replace全都没有效果代替不了
strXml.Replace("$name$", name);
strXml.Replace("$dt$", dt);
strXml.Replace("$ticketCount[0]$", ticketCount[0]);
strXml.Replace("$ticketCount[1]$", ticketCount[1]);
strXml.Replace("$ticketCount[2]$", ticketCount[2]);
strXml.Replace("$ticketCount[3]$", ticketCount[3]);
strXml.Replace("$ticketCount[4]$", ticketCount[4]);
strXml.Replace("$ticketCount[5]$", ticketCount[5]);
strXml.Replace("$childTicketCount[0]$", childTicketCount[0]);
strXml.Replace("$childTicketCount[1]$", childTicketCount[1]);
strXml.Replace("$childTicketCount[2]$", childTicketCount[2]);
strXml.Replace("$childTicketCount[3]$", childTicketCount[3]);
strXml.Replace("$childTicketCount[4]$", childTicketCount[4]);
strXml.Replace("$childTicketCount[5]$", childTicketCount[5]);
strXml.Replace("$parkOrderID$", parkOrderID);
strXml.Replace("$checkCode$", checkCode); //打印内容
Response.Write(strXml);-------------------
xml文件
<?xml version="1.0" encoding="utf-8" ?><root><pagesetting><Landscape>false</Landscape><paperkind>A4</paperkind><paperwidth>1512</paperwidth><paperheight>2088</paperheight><pageleft>0</pageleft><pageright>0</pageright><pagetop>0</pagetop><pagebottom>0</pagebottom></pagesetting><barCode><barX_1>400</barX_1><barY_1>200</barY_1><barX_2>400</barX_2><barY_2>600</barY_2><barX_3>400</barX_3><barY_3>800</barY_3><barWidth>200</barWidth><barHeight>100</barHeight><Code>031523</Code><CodeFont>Bar Code 39 f HR</CodeFont><CodeSize>26</CodeSize></barCode><Note><Text>说明测试宋体12px位置X=100 Y=150 W=200 H=100</Text><TextFont>宋体</TextFont><TextSize>12</TextSize><TextWidth>200</TextWidth><TextHeight>100</TextHeight><TextX>50</TextX><TextY>100</TextY></Note><reporttable><table x="41" y="0" border="0" bordercolor="Black" maxlines="1150"><tablehead></tablehead><tablebody> <tr height='40'>
<td colspan='3' align='center' fontname='宋体' fontsize='24'>$parkname$</td>
</tr>
<tr>
<td align='right' width='30%'>宾客姓名</td>
<td width='20%'>$name$</td>
<td></td>
</tr>
<tr>
<td align='right' width='30%'>门票项目</td>
<td width='20%'>$parkname$</td>
<td></td>
</tr>
<tr>
<td align='right' width='30%'>有效期</td>
<td width='20%'>$dt$</td>
<td>
</td>
</tr>
<tr height='25'>
<td align='right' width='30%'>购票数量</td>
</tr>
<tr height='25' width='50%'>
<td align='right' width='30%'>单日成人票</td>
$ticketCount[0]$
<td width='20'>$ticketCount[1]$</td>
<td width='20'>$ticketCount[2]$</td>
<td width='20'>$ticketCount[3]$</td>
<td width='20'>$ticketCount[4]$</td>
<td width='20'>$ticketCount[5]$</td>
</tr>
<tr height='25'>
<td align='right' width='30%'>单日儿童票</td>
$childTicketCount[0]$
<td width='20'>$childTicketCount[1]$</td>
<td width='20'>$childTicketCount[2]$</td>
<td width='20'>$childTicketCount[3]$</td>
<td width='20'>$childTicketCount[4]$</td>
<td width='20'>$childTicketCount[5]$</td>
<td width='100' align='right'>票号:</td><td width='50'>$parkOrderID$</td><td width='100' align='right'>验证码</td><td>$checkCode$</td>
</tr>
<tr>
<td align='center'>备注:1.1米以下小童免费</td>
</tr>
<tr>
<td align='right' width='80%' fontname='宋体' fontsize='10'>$parkname$保存</td>
</tr>
</tablebody><tablefoot></tablefoot></table></reporttable></root>
String strXml = sr.ReadToEnd();
sr.Close();
strXml.Replace("$parkname$", parkname); //这里面的replace全都没有效果代替不了
strXml.Replace("$name$", name);
strXml.Replace("$dt$", dt);
strXml.Replace("$ticketCount[0]$", ticketCount[0]);
strXml.Replace("$ticketCount[1]$", ticketCount[1]);
strXml.Replace("$ticketCount[2]$", ticketCount[2]);
strXml.Replace("$ticketCount[3]$", ticketCount[3]);
strXml.Replace("$ticketCount[4]$", ticketCount[4]);
strXml.Replace("$ticketCount[5]$", ticketCount[5]);
strXml.Replace("$childTicketCount[0]$", childTicketCount[0]);
strXml.Replace("$childTicketCount[1]$", childTicketCount[1]);
strXml.Replace("$childTicketCount[2]$", childTicketCount[2]);
strXml.Replace("$childTicketCount[3]$", childTicketCount[3]);
strXml.Replace("$childTicketCount[4]$", childTicketCount[4]);
strXml.Replace("$childTicketCount[5]$", childTicketCount[5]);
strXml.Replace("$parkOrderID$", parkOrderID);
strXml.Replace("$checkCode$", checkCode); //打印内容
Response.Write(strXml);-------------------
xml文件
<?xml version="1.0" encoding="utf-8" ?><root><pagesetting><Landscape>false</Landscape><paperkind>A4</paperkind><paperwidth>1512</paperwidth><paperheight>2088</paperheight><pageleft>0</pageleft><pageright>0</pageright><pagetop>0</pagetop><pagebottom>0</pagebottom></pagesetting><barCode><barX_1>400</barX_1><barY_1>200</barY_1><barX_2>400</barX_2><barY_2>600</barY_2><barX_3>400</barX_3><barY_3>800</barY_3><barWidth>200</barWidth><barHeight>100</barHeight><Code>031523</Code><CodeFont>Bar Code 39 f HR</CodeFont><CodeSize>26</CodeSize></barCode><Note><Text>说明测试宋体12px位置X=100 Y=150 W=200 H=100</Text><TextFont>宋体</TextFont><TextSize>12</TextSize><TextWidth>200</TextWidth><TextHeight>100</TextHeight><TextX>50</TextX><TextY>100</TextY></Note><reporttable><table x="41" y="0" border="0" bordercolor="Black" maxlines="1150"><tablehead></tablehead><tablebody> <tr height='40'>
<td colspan='3' align='center' fontname='宋体' fontsize='24'>$parkname$</td>
</tr>
<tr>
<td align='right' width='30%'>宾客姓名</td>
<td width='20%'>$name$</td>
<td></td>
</tr>
<tr>
<td align='right' width='30%'>门票项目</td>
<td width='20%'>$parkname$</td>
<td></td>
</tr>
<tr>
<td align='right' width='30%'>有效期</td>
<td width='20%'>$dt$</td>
<td>
</td>
</tr>
<tr height='25'>
<td align='right' width='30%'>购票数量</td>
</tr>
<tr height='25' width='50%'>
<td align='right' width='30%'>单日成人票</td>
$ticketCount[0]$
<td width='20'>$ticketCount[1]$</td>
<td width='20'>$ticketCount[2]$</td>
<td width='20'>$ticketCount[3]$</td>
<td width='20'>$ticketCount[4]$</td>
<td width='20'>$ticketCount[5]$</td>
</tr>
<tr height='25'>
<td align='right' width='30%'>单日儿童票</td>
$childTicketCount[0]$
<td width='20'>$childTicketCount[1]$</td>
<td width='20'>$childTicketCount[2]$</td>
<td width='20'>$childTicketCount[3]$</td>
<td width='20'>$childTicketCount[4]$</td>
<td width='20'>$childTicketCount[5]$</td>
<td width='100' align='right'>票号:</td><td width='50'>$parkOrderID$</td><td width='100' align='right'>验证码</td><td>$checkCode$</td>
</tr>
<tr>
<td align='center'>备注:1.1米以下小童免费</td>
</tr>
<tr>
<td align='right' width='80%' fontname='宋体' fontsize='10'>$parkname$保存</td>
</tr>
</tablebody><tablefoot></tablefoot></table></reporttable></root>
解决方案 »
- 使用ajaxpro 后台传值给前台页面报错!
- img元素的问题
- 错误 1 命名空间“System.Web.UI”中不存在类型或命名空间名称“AdminPage”。是否缺少程序集引用? D:\xinyangwater\xysU
- 磁盘映射
- 求教大侠们。网页如何得到ActivX属性和变量,同样,ActiveX如何得网页参数??
- 反射问题。。求指教
- 问个ReaderWriterLockSlim的问题
- 我新建一个项目,提示错误:程序在“.../../debug/aa.exe”下未指明程序入口点 这个错误该如何解决啊。
- 急!这里面哪句有错
- windows域用户通过WEB来修改登陆密码,如何做到?重分必酬!
- try 语句中如何实现 ON ERROR RESUME NEXT
- 想用gridview 控件网页页面进行求和,求平均,请前辈指点!
.........
返回一个新的字符串引用对象
所以你必须这样用Replace()
str = str.Replace(xxxxx);
str = str.Replace(yyyyy);
也就是操作后需要重新赋值
replace,remove方法都是这样的。