Il est souvent utilisé lors de la sortie de RSS et XML, et n'est pas exactement la même chose que HTMLENCODE
principe:
| Personnage | Converti en |
| " | |
| ' | ' |
| & | & |
| < | < |
| > | > |
Code
<%
Fonction xmlencode (byVal stext)
stext = remplacer (stext, "&", "&")
stext = remplacer (stext, "<", "<")
stext = remplacer (stext, ">", ">")
stext = remplacer (stext, "'", "'")
stext = remplacer (stext, "" "", "")
Xmlencode = stext
Fonction finale
%>
Un autre:
<%
Fonction publique XMLENCODODE (BYVAL StrText As String) en tant que chaîne
Dim arychars () en tant que variante
arychars = tableau (38, 60, 62, 34, 61, 39)
Dim I comme entier
Pour i = 0 à Ubound (arychars)
strText = remplacer (strText, chr (arychars (i)), "& #" & arychars (i) & ";")
Suivant
Xmlencode = strText
Fonction finale
%>