Thread: xpath_* namespace bug

xpath_* namespace bug

From
CG
Date:
select xpath_string($xml$<?xml version="1.0" ?>
<f:foo xmlns:f="foo">
  <f:bar>baz</f:bar>
</f:foo>
$xml$
,'//f:bar/text()');

This does not give me back "baz" as I was expecting it to... It seems like xpath is ignoring the namespace directives
inthe source XML document. 



____________________________________________________________________________________
TV dinner still cooling?
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/

Re: xpath_* namespace bug

From
"Nikolay Samokhvalov"
Date:
AFAIK, contrib/xml2 doesn't support namespaces for XPath expressions
at all. Wait for PostgreSQL 8.3 :-)

On 7/9/07, CG <cgg007@yahoo.com> wrote:
> select xpath_string($xml$<?xml version="1.0" ?>
> <f:foo xmlns:f="foo">
>   <f:bar>baz</f:bar>
> </f:foo>
> $xml$
> ,'//f:bar/text()');
>
> This does not give me back "baz" as I was expecting it to... It seems like xpath is ignoring the namespace directives
inthe source XML document. 
>
>
>
> ____________________________________________________________________________________
> TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.
> http://tv.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>


--
Best regards,
Nikolay

Re: xpath_* namespace bug

From
CG
Date:
Can't wait... Got to have it now. :(

I patched xpath.c and created a function which takes a third parameter which are the known namespaces in a space
delimitedhash list ... I based the patch on some example code from the libxml website which works perfectly from the
commandline. However, in PostgreSQL, it only works 65% of the time. The other 35% of the time it returns an empty
string.I have no idea how to debug that kind of problem. 

You make it sound like 8.3 will have full-featured xpath_* frunctions. Will it have full-featured xslt support as well?

----- Original Message ----
From: Nikolay Samokhvalov <samokhvalov@gmail.com>
To: CG <cgg007@yahoo.com>
Cc: postgresql listserv <pgsql-general@postgresql.org>
Sent: Monday, July 9, 2007 4:33:04 PM
Subject: Re: [GENERAL] xpath_* namespace bug


AFAIK, contrib/xml2 doesn't support namespaces for XPath expressions
at all. Wait for PostgreSQL 8.3 :-)

On 7/9/07, CG <cgg007@yahoo.com> wrote:
> select xpath_string($xml$<?xml version="1.0" ?>
> <f:foo xmlns:f="foo">
>   <f:bar>baz</f:bar>
> </f:foo>
> $xml$
> ,'//f:bar/text()');
>
> This does not give me back "baz" as I was expecting it to... It seems like xpath is ignoring the namespace directives
inthe source XML document. 
>
>
>
> ____________________________________________________________________________________
> TV dinner still cooling?
> Check out "Tonight's Picks" on Yahoo! TV.
> http://tv.yahoo.com/
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
>


--
Best regards,
Nikolay



____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php

Re: xpath_* namespace bug

From
"Nikolay Samokhvalov"
Date:
On 7/10/07, CG <cgg007@yahoo.com> wrote:
> Can't wait... Got to have it now. :(
>
> I patched xpath.c and created a function which takes a third parameter which are the known namespaces in a space
delimitedhash list ... I based the patch on some example code from the libxml website which works perfectly from the
commandline. However, in PostgreSQL, it only works 65% of the time. The other 35% of the time it returns an empty
string.I have no idea how to debug that kind of problem. 

Maybe if you look at the current CVS code (xml.c) it can help (as I've
said, namespaces support is implemented there).

>
> You make it sound like 8.3 will have full-featured xpath_* frunctions. Will it have full-featured xslt support as
well?

No. For XSLT, you'll still have to use contrib/xml2. This most
probably will be changed in future versions (separate contrib/xslt or
something).

--
Best regards,
Nikolay