Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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!

pgsql-general by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group