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

Re: Adding xpath_exists function

From: Mike Fowler <mike(at)mlfowler(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding xpath_exists function
Date: 2010-05-11 09:21:43
Message-ID: 4BE921A7.7060401@mlfowler.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-rrreviewers
Robert Haas wrote:
> Please email your patch to the list (replying to this email is fine)
> and add it here:
> https://commitfest.postgresql.org/action/commitfest_view/open
>   
Here's my patch, developed against HEAD, that adds the function 
'xpath_exists'. The function is a lot simpler than originally thought, 
so none of the string manipulation previously discussed was required. 
I've also included some regression tests that test the function with and 
without xml namespaces. I should  note that before I added my tests all 
existing tests passed.

One observation that can be made is that I've largely copied the 
existing xpath function and altered it to use a different method from 
the libxml API. I've done it to save me redoing all the namespace 
handling, however it's apparent to me that if we wanted to expose more 
of the libxml api we will quickly start having a lot of duplicate code. 
I notice that refactoring existing code whilst adding new code is 
generally frowned upon, so once this patch is accepted I will look to 
refactor the xpath and xpath_exists function. I could even add an 
xpath_count method at the same time ;) .

Thanks in advance for any and all feedback,

-- 
Mike Fowler
Registered Linux user: 379787

"I could be a genius if I just put my mind to it, and I,
I could do anything, if only I could get 'round to it"
-PULP 'Glory Days'


Attachment: xpath_exists-1.patch
Description: text/x-diff (11.8 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Robert HaasDate: 2010-05-11 11:29:36
Subject: Re: Partitioning/inherited tables vs FKs
Previous:From: Heikki LinnakangasDate: 2010-05-11 08:45:02
Subject: Re: Patch for PKST timezone

pgsql-rrreviewers by date

Next:From: Selena DeckelmannDate: 2010-05-20 21:20:53
Subject: Heads up! Review fest starting June 15
Previous:From: Mike FowlerDate: 2010-05-07 09:46:55
Subject: Re: Adding xpath_exists function

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