Re: Proposal: XML helper functions

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Scott Bailey <artacus(at)comcast(dot)net>
Cc: hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: XML helper functions
Date: 2010-01-05 18:26:26
Message-ID: b42b73151001051026o3c566c7cw5ee94a1a00a4cd4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jan 5, 2010 at 1:14 PM, Scott Bailey <artacus(at)comcast(dot)net> wrote:
> One of the problem with shredding XML is that it is very kludgy to get a
> scalar value back from xpath. The xpath function always returns an array of
> XML. So for example, to extract a numeric value you need to:
> 1) use xpath to get the node
> 2) get the first element of the XML array
> 3) cast that to varchar
> 4) cast that to numeric

I just happen to be dealing with XML right now as well and my initial
thought is that your suggestion doesn't buy you a whole lot: the root
problem IMO is not dealing with what xpath gives you but that there is
no DOMish representation of the xml document for you to query. You
have to continually feed the entire document to xpath which is
absolutely not scalable (if it works the way I think it does --
haven't looked at the code).

xpath is great for simple things but it's too texty and you need a
more robust API to handle documents for serious parsing on the
backend. In the short term i'd advise doing work in another pl like
perl.

merlin

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2010-01-05 18:33:33 Re: Proposal: XML helper functions
Previous Message Robert Haas 2010-01-05 18:22:28 Re: Stats for inheritance trees