Re: xpath and xml namespaces

From: "Nikolay Samokhvalov" <samokhvalov(at)gmail(dot)com>
To: "Peter Schonefeld" <peter(dot)schonefeld(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: xpath and xml namespaces
Date: 2007-03-04 16:27:00
Message-ID: e431ff4c0703040827t44224a26xe206634fcdca16af@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 3/4/07, Peter Schonefeld <peter(dot)schonefeld(at)gmail(dot)com> wrote:
> Hi, i'm having trouble getting xpath in Postgres 8.2 to recognise xml
> namespaces...could someone please point me to a good reference for the xml2
> lib?

This is FAQ-like question.
The thing is that XPath spec doesn't define any default mappings for
namespaces. It's considered as entirely user's problem -- he should
manually define namespaces mappings to use namespace prefixes in XPath
expressions.

If you use contrib/xml2 I'm afraid there is no way to use namespaces
in XPath w/o changing contib's code itself... To enable namespaces
using libxml2 one should use xmlXPathRegisterNs():
http://xmlsoft.org/html/libxml-xpathInternals.html#xmlXPathRegisterNs

I hope 8.3 will have XPath function with namespaces support in core.

--
Best regards,
Nikolay

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sandeep Kumar Jakkaraju 2007-03-04 16:34:31 how to pass an array to the plpgsql function from Java Code
Previous Message Raymond O'Donnell 2007-03-04 16:16:21 Re: date format