Is there any way to search in XML doc with match case? In this post I see searching with exact match: XPath query for exact match
What I want to achieve is to get all matching elements according to my criteria.
Like if I have the following XML:
<Videos>
<Misc URL="http://ccc/.webm1.webm" />
<Misc URL="http://bbb/OGG_2.ogv" />
<Misc URL="http://aaa/OGG_3.ogv" />
<Misc URL="http://ccc/.webm4.webm" />
<Misc URL="http://bbb/OGG_5.ogv" />
<Misc URL="http://aaa/OGG_6.ogv" />
</Videos>
I want to get all nodes that contain or having .ogv, similarly all that contains .webm extensions.
Any idea how to get this?
//Misc[substring(@URL, string-length(@URL)-3)='.ogv']The above uses XPath 1.0 and simply performs a substring and returns the last 3 characters to match against
.ogv.Also, to simplify the above, using XPath 2.0
//Videos/Misc[ends-with(@URL, '.ogv')].