C#不支持XPATH2.0

.net中的XPATH是1.0版本的,很多2.0中的函数是不兼容的,比如lower-case()、replace()函数等,下面中的XPATH语句在运行时会报错

//table[contains(lower-case(normalize-space(string()),'investment objective') and contains(lower-case(normalize-space(string())),'investment advisor')]

Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.

只能用别的函数进行替换了translate(normalize-space(string()),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz')修改后的语句可以成功运行!

//table[contains(translate(normalize-space(string()),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'investment objective') and contains(translate(normalize-space(string()),'ABCDEFGHIJKLMNOPQRSTUVWXYZ','abcdefghijklmnopqrstuvwxyz'),'investment advisor')]
原文地址:https://www.cnblogs.com/JTCLASSROOM/p/11038297.html