Re: xpath_array with namespaces support

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: nikolay(at)samokhvalov(dot)com
Cc: PGSQL-Patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: xpath_array with namespaces support
Date: 2007-03-01 02:11:45
Message-ID: 200703010211.l212Bju02554@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Nikolay Samokhvalov wrote:
> As a result of discussion with Peter, I provide modified patch for
> xpath_array() with namespaces support.
>
> The signature is:
> _xml xpath_array(text xpathQuery, xml xmlValue[, _text namespacesBindings])
>
> The third argument is 2-dimensional array defining bindings for
> namespaces. Simple examples:
>
> xmltest=# SELECT xpath_array('//text()', '<local:data
> xmlns:local="http://127.0.0.1"><local:piece id="1">number
> one</local:piece><local:piece id="2" /></local:data>');
> xpath_array
> ----------------
> {"number one"}
> (1 row)
>
> xmltest=# SELECT xpath_array('//loc:piece/@id', '<local:data
> xmlns:local="http://127.0.0.1"><local:piece id="1">number
> one</local:piece><local:piece id="2" /></local:data>',
> ARRAY[ARRAY['loc'], ARRAY['http://127.0.0.1']]);
> xpath_array
> -------------
> {1,2}
> (1 row)
>
> Thoughts regarding other XPath functions were exposed a couple of days
> ago: http://archives.postgresql.org/pgsql-patches/2007-02/msg00373.php
>
> If there is no objections, we could call the function provided in this
> patch as xpath() or xmlpath() (the latter is similar to SQL/XML
> functions).
>
> Also, maybe someone can suggest better approach for passing namespace
> bindings (more convenient than ARRAY[ARRAY[...], ARRAY[...]])?
>
> --
> Best regards,
> Nikolay

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonah H. Harris 2007-03-01 02:16:21 Re: COMMIT NOWAIT Performance Option
Previous Message Bruce Momjian 2007-03-01 02:09:55 Re: What is CheckPoint.undo needed for?

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2007-03-01 02:23:03 Re: Numeric patch to add special-case representations for < 8 bytes
Previous Message Bruce Momjian 2007-03-01 02:10:17 Re: lo_truncate