Re: xpath and xml namespaces - Mailing list pgsql-general

From Nikolay Samokhvalov
Subject Re: xpath and xml namespaces
Date
Msg-id e431ff4c0703040827t44224a26xe206634fcdca16af@mail.gmail.com
Whole thread Raw
In response to xpath and xml namespaces  ("Peter Schonefeld" <peter.schonefeld@gmail.com>)
List pgsql-general
On 3/4/07, Peter Schonefeld <peter.schonefeld@gmail.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

pgsql-general by date:

Previous
From: Raymond O'Donnell
Date:
Subject: Re: date format
Next
From: "Sandeep Kumar Jakkaraju"
Date:
Subject: how to pass an array to the plpgsql function from Java Code