[GENERAL] xpath and xml namespaces

2007-03-04 Thread Peter Schonefeld

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?

Cheers
Pete


Re: [GENERAL] xpath and xml namespaces

2007-03-04 Thread Nikolay Samokhvalov

On 3/4/07, Peter Schonefeld [EMAIL PROTECTED] 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

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly