How can I escape a string in classic ASP for use in XPath query?
I have string I'd like to escape for use in an XPath query. In C# I am able to do this using a call to SecurityElement.Escape
. Is there an equivalent call开发者_如何学Python in classic ASP?
No, you'll need to deal with string escape yourself.
xpath = "//node[@attribute='" & SecurityElementEscape(value) & "']"
Function SecurityElementEscape(value)
SecurityElementEscape =
Replace(Replace(Replace(Replace(Replace(value,
"&" , "&" ), '' // must be first one
"<" , "<" ),
">" , ">" ),
"""", """),
"'" , "'")
End Function
精彩评论