用ASP从数据库中读出的数据生成XML,但是数据库中有特殊字符时,报错,该如何处理
时间:2003-05-19
来源:互联网
A semi colon character was expected. Error processing resource 'http://myweb.com/xmlweb/cert-rpt-XML.asp'. Line 19, Position 9
<des>K&S 1484/1488 W/B</des>
--------^
其中K&S 1484/1488 W/B为数据库中Table 里的信息.由于含有字符"&",在运行
'http://myweb.com/xmlweb/cert-rpt-XML.asp'时报以上错误.由于我不能修改
数据库table里的内容,请问如何修改我的程序.
<%@ language="VBScript" %>
<?xml version="1.0" encoding="gb2312"?>
<?xml:stylesheet type="text/xsl" href="'http://myweb.com/xmlweb/XSL/CERT-RPT-XML.xsl"?>
<% Dim Dataconn,ConStr,Connect,ADDNEWRS,ADDNEWRS2,I,Link,LINEC,C %>
<% DataConn = "d:\database\OJTDB"%>
<% Set Connect = Server.CreateObject("ADODB.Connection")%>
<% ConStr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & DataConn & ";" %>
<% Connect.open(ConStr) %>
<% Set ADDNEWRS=Server.CreateObject("ADODB.Recordset") %>
<% ADDNEWRS.Open "SELECT * FROM [CERT-WillExpire] ORDER BY [CERT-WillExpire].[DEPT NO],[CERT-WillExpire].[certification DATE]",Connect, 1,3 %>
<certdata>
<% ADDNEWRS.MOVEFIRST %>
<% I=0 %>
<% DO until ADDNEWRS.EOF %>
<% I=I+1 %>
<certrecord>
<SN><% =I %></SN>
<deptno><% =ADDNEWRS("DEPT NO") %></deptno>
<name><% =ADDNEWRS("name(e)") %></name>
<certcode><% =ADDNEWRS("certificate") %></certcode>
<des><% =ADDNEWRS("machine/process introduction") %></des>
<type><% =ADDNEWRS("MAIN") %></type>
<date><% =ADDNEWRS("certification Date") %></date>
</certrecord>
<% ADDNEWRS.MOVEnext %>
<% LOOP %>
</certdata>
作者: Amo_Lin 发布时间: 2003-05-19
作者: 上水道的 发布时间: 2003-05-19
作者: Amo_Lin 发布时间: 2003-05-19
试试
<des><![CDATA[<% =ADDNEWRS("machine/process introduction") %>]></des>
要么用脚本替换
作者: bencalie 发布时间: 2003-05-19
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
A CDATA section was not closed. Error processing resource 'http://myweb.com/xmlweb/cert-rpt-XML.asp'. Line 19, Position 15
<des><![CDATA[CAL BY USER]></des>
--------------^
作者: Amo_Lin 发布时间: 2003-05-19
<des><![CDATA[<% =ADDNEWRS("machine/process introduction") %>]]></des>
脚本就是把&替换成&amp;(半角)
作者: bencalie 发布时间: 2003-05-19
作者: Amo_Lin 发布时间: 2003-05-19
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28