当前位置:首页 > 网络编程 > WEB编程 > ASP > asp函数转换xml中的实体字符[转义符]

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

点击次数:76 次 发布日期:2008-10-22 06:42:37 作者:源代码网
源代码网推荐

源代码网整理以下以下为引用的内容:

<%
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)
会员中心
网络编程
本站推荐
网络编程之精华