开发者

Is it possible to ignore case using xpath and c#?

开发者 https://www.devze.com 2023-01-27 20:02 出处:网络
Just wondered if it开发者_开发百科s possible to ignore case with c# and xpath when searching an xml document?The bad news is that Xpath is case sensitive, however there are ways to get around this.Hav

Just wondered if it开发者_开发百科s possible to ignore case with c# and xpath when searching an xml document?


The bad news is that Xpath is case sensitive, however there are ways to get around this. Have a look at the following MSDN blog:

http://blogs.msdn.com/b/shjin/archive/2005/07/22/442025.aspx


XPath is case sensitive.

If you would allow any case combination of characters in a name (bad decision!), an XPath expression successfully dealing with this might look like:

/a/b/*['anycasename' 
      = translate(name(), 
                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                 'abcdefghijklmnopqrstuvwxyz'
                 )
      ]
0

精彩评论

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