'过滤特殊字符
Public Function XmlEncode(sStr)
If Trim(sStr) = "" Or IsNull(sStr) Then
XmlEncode = ""
Exit Function
End If
sStr = Trim(sStr)
Dim i
i = 0
Dim sRet
sRet = ""
'遍历传入的每个字符,如果遇到特殊字符,则替换成该字符的编码
For i = 1 To Len(sStr)
Select Case Mid(sStr, i, 1)
Case "&"
sRet = sRet & "&"
Case "'"
sRet = sRet & "'"
Case "\"""
sRet = sRet & """
Case "<"
sRet = sRet & "<"
Case ">"
sRet = sRet & ">"
Case Else
sRet = sRet & Mid(sStr, i, 1)
End Select
Next
XmlEncode = sRet
End Function