开发者

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
            "<" , "&lt;"  ),
            ">" , "&gt;"  ), 
            """", "&quot;"), 
            "'" , "&apos;") 
End Function
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜