Problem with xpath function and full xml documents

From: Cheetah <fastcat(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Problem with xpath function and full xml documents
Date: 2008-07-16 20:30:40
Message-ID: a9d6776b0807161330y74491836kee6f919edc4438c5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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!

Browse pgsql-general by date

  From Date Subject
Next Message Harvey, Allan AC 2008-07-16 22:30:12 Re: 8.3.3 regression test on SCO 5.0.7
Previous Message Shane Ambler 2008-07-16 18:17:12 Re: 10.5 OS X ppc64 problem