Really? Either that's a bug, or it's declared wrong.
I was not accurate. "<tag /><tag />" is not valid xml document - and xpath function doens't like it.
postgres=# select xpath('//tag/@x','<tag x="x"/><tag />'::xml); ERROR: could not parse XML document DETAIL: line 1: Extra content at the end of the document <tag x="x"/><tag /> ^ CONTEXT: SQL function "xpath" statement 1 postgres=# select xpath('//tag/@x','<x><tag x="x"/><tag /></x>'::xml); xpath ------- {x} (1 row)