asp函数转换xml中的实体字符[转义符]

作者:佚名 来源:aspxuexi.com 时间:2008-10-16 17:07:00 




<%
Function XMLEncode(byVal sText)
sText = Replace(sText, "&" , "&amp;")
sText = Replace(sText, "<" , "&lt;")
sText = Replace(sText, ">" , "&gt;")
sText = Replace(sText, "'" , "&apos;")
sText = Replace(sText, """", "&quot;")
XMLEncode = sText
End Function
%>



或者

<%
Public Function XmlEncode(strText)
Dim aryChars
aryChars = Array(38, 60, 62, 34, 61, 39)
Dim i
For i = 0 To UBound(aryChars)
strText = Replace(strText, Chr(aryChars(i)), "&#" & aryChars(i) & ";")
Next
XmlEncode = strText
End Function
%>


标签:
0
投稿

猜你喜欢

  • 判断字段是否被更新 新旧数据写入Audit Log表中

    2012-01-29 17:56:33
  • 仿阿里巴巴搜索导航设计效果

    2008-04-15 15:01:00
  • 一个完美网站的101项指标.第四部分.设计

    2008-02-29 22:22:00
  • PHP+MYSQL不恶补十句话

    2009-12-02 10:09:00
  • MySQL数据库中修改密码及访问限制设置详解

    2009-09-01 14:19:00
  • Microsoft Enterprise Library 5.0 如何集成MyS

    2011-03-16 15:19:00
  • 五个常用MySQL图形化管理工具

    2012-01-05 18:49:16
  • 键盘上下键的操作代码(选择)

    2008-06-10 12:28:00
  • 教你用FrontPage2003轻松布局网页

    2008-02-24 17:05:00
  • ASP实现GB2312字符与区位码的相互转换

    2009-12-28 10:27:00
  • 使用MySQL数据库的23个注意事项

    2010-03-18 15:46:00
  • 用正则替换所有URL

    2009-03-13 13:51:00
  • 创意设计:字母趣味组合

    2008-01-26 18:50:00
  • 正则 global 属性介绍

    2008-03-18 20:50:00
  • [设计]DREAMWEAVER 问题集锦

    2010-09-02 12:31:00
  • 在js中的replace方法详解

    2007-08-21 15:47:00
  • HTML中事件触发列表与解说

    2007-10-22 12:50:00
  • javascript双击自动滚屏单击停止

    2008-10-13 13:05:00
  • 浅析DW4中的站点管理

    2007-02-03 11:40:00
  • 两行代码实现的QQ窗口抖动效果

    2008-09-06 12:34:00
  • asp之家 网络编程 m.aspxhome.com