xml – xpath中的不区分大小写的匹配?
发布时间:2020-12-16 08:13:01 所属栏目:百科 来源:网络整理
导读:例如,对于下面的xml CATALOG CD title="Empire Burlesque"/ CD title="empire burlesque"/ CD title="EMPIRE BURLESQUE"/ CD title="EmPiRe BuRLeSQuE"/ CD title="Others"/CATALOG 如何匹配前4条记录与xpath像// CD [@ title =’empire burlesque’]。有没
例如,对于下面的xml
<CATALOG> <CD title="Empire Burlesque"/> <CD title="empire burlesque"/> <CD title="EMPIRE BURLESQUE"/> <CD title="EmPiRe BuRLeSQuE"/> <CD title="Others"/> <CATALOG> 如何匹配前4条记录与xpath像// CD [@ title =’empire burlesque’]。有没有xpath函数来做到这一点?其他解决方案如PHP函数也被接受。
XPath 2具有小写(和大写)字符串函数。这与不区分大小写的不一样,但希望它足够接近:
//CD[lower-case(@title)='empire burlesque'] 如果使用XPath 1,则有一个hack using translate。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |