作家
登录

ASP常用函数:XMLEncode

作者: 来源:www.28hudong.com 2013-03-30 08:47:06 阅读 我要评论

输出RSS和XML时经常用到,和HTMLEncode还不完全一样 原理: Character Converted To " " ' ' & & < < > > 代码<%Function XMLEncode(byVal sText) sText = Replace(sText, "&" , "&") sText = Replace(sText, "<" , "<") sText = Replace(sText, ">" , ">") sText = Replace(sText, "'" , "'") sText = Replace(sText, """", """) XMLEncode = sTextEnd Function%>还有个:<%Public Function XmlEncode(ByVal strText As String) As String Dim aryChars() As Variant aryChars = Array(38, 60, 62, 34, 61, 39) Dim i As Integer For i = 0 To UBound(aryChars) strText = Replace(strText, Chr(aryChars(i)), "&#" & aryChars(i) & ";") Next XmlEncode = strTextEnd Function%>

  推荐阅读

  ASP常用函数:ReplaceHTML

<% '去掉HTML标记 Public Function ReplaceHTML(Textstr) Dim Str, re Str = Textstr Set re = New RegExp re.IgnoreCase = True re.Global = True re.Pattern = "<(.[^>]*)>" Str = >>>详细阅读


本文标题:ASP常用函数:XMLEncode

地址:http://www.17bianji.com/kaifa2/ASP/32743.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)