您现在的位置是:网站首页> 编程资料编程资料
ASP常用函数:XMLEncode_ASP基础_
2023-05-25
140人已围观
简介 ASP常用函数:XMLEncode_ASP基础_
输出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 = sText
End 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 = strText
End Function
%>
相关内容
- ASP常用函数:CLngIP()_ASP基础_
- ASP常用函数:CStrIP()_ASP基础_
- On Error Resume Next 语句_ASP基础_
- IIS 错误 Server Application Error 详细解决方法_ASP基础_
- Eval 函数 | Execute 语句 | ExecuteGlobal 语句使用说明_ASP基础_
- [转]ASP常用函数:TimeZone_ASP基础_
- HTTP_HOST 和 SERVER_NAME 的区别详解_ASP基础_
- ServerVariables集合检索预定的环境变量_ASP基础_
- 对象标记具有无效的 'MSWC.MyInfo' ProgID_ASP基础_
- [转]ASP实现关键词获取(各搜索引擎,GB2312及UTF-8)_应用技巧_
