Let's say I have a table called "xml" that stores XML files in a single "data" column. How to write a MySQL query that runs XPath and return only rows matching that XPath?
SELECT * FROM xml WHERE EXTRACTVALUE(data, '<xpath-expr>') != '';
It should be noted, however, that there are restrictions on supporting MySQL XPath.
EXTRACTVALUE()
I just got a response from a colleague, it seems that xml cropping often helps:
select * from xml where trim(both '\r\n' from ExtractValue(xml, '/some/xpath')) = 'value';