How can I avoid a string in classic ASP for use in an XPath request?

I have a string that I would like to avoid for use in an XPath query. In C #, I can do this using a call SecurityElement.Escape. Is there an equivalent call in classic ASP?

+3
source share
1 answer

No, you will need to handle the escape of the string.

xpath = "//node[@attribute='" & SecurityElementEscape(value) & "']"

Function SecurityElementEscape(value)
    SecurityElementEscape = 
        Replace(Replace(Replace(Replace(Replace(value, 
            "&" , "&" ), '' // must be first one
            "<" , "&lt;"  ),
            ">" , "&gt;"  ), 
            """", "&quot;"), 
            "'" , "&apos;") 
End Function
+3
source

Source: https://habr.com/ru/post/1730248/


All Articles