I'm trying to use the xpath function to search through an xml field stored in my database (pgsql 8.3.3 win32). It is failing miserably, because the xpath function appears to wrap my xml content in an <x></x> element. It then tels me it can't parse the xml data because my xml fields have the <?xml ...> at the start: 2008-07-16 16:11:18 ERROR : ERROR: could not parse XML data DETAIL: Entity: line 1: parser error : XML declaration allowed only at the start of the document <x><?xml version="1.0" encoding="utf-8"?> ^ I really don't want to go through and remove the <?xml> declarations from the field contents, esp. since they are generated by code that I'm not sure even supports suppressing that. Is there any other way to make this work? It seems rather odd to me that the xpath function would be wrapping a full document in an extra element. I can see why it has to do that for fragments, but for a document it doesn't seem right. I'm not subscribed, so please CC me on replies!