A menudo se usa al emitir RSS y XML, y no es exactamente lo mismo que HTMLENCODEDE
principio:
| Personaje | Convertido en |
| " | |
| ' | ' |
| Y | Y |
| < | < |
| > | > |
Código
<%
Función xmlencode (byval stext)
Stext = reemplazar (Stext, "&", "&")
Stext = reemplazar (Stext, "<", "<")
Stext = reemplazar (Stext, ">", ">")
Stext = reemplazar (Stext, "'", "'")
Stext = reemplazar (Stext, "" "", "")
Xmlencode = Stext
Función final
%>
Otro:
<%
Función pública xmlencode (byval strtext as string) como string
Dim arychars () como variante
arychars = array (38, 60, 62, 34, 61, 39)
Dim I como entero
Para i = 0 a Ubound (arychars)
strtext = reemplazar (strText, chr (arychars (i)), "&#" & arychars (i) & ";")
Próximo
Xmlencode = strText
Función final
%>