Re: help with xpath namespace

From: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
To: Brian Sherwood <bdsher(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: help with xpath namespace
Date: 2011-09-23 16:14:14
Message-ID: CAP_rwwk6n0HTyxYd396UWustKom3Ku0dDSs7+u-RNr7kqX+6TA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

2011/9/22 Brian Sherwood <bdsher(at)gmail(dot)com>

>
> select (xpath('/chassis-inventory/chassis/serial-number/text()',
> data_xml,
> ARRAY[ARRAY['junos',
> 'http://xml.juniper.net/junos/9.6R4/junos-chassis']]
> )) from xml_test;
>
> Can anyone suggest how I would go about getting the serial-number with
> xpath?
>
>

http://www.postgresql.org/docs/9.1/static/functions-xml.html#FUNCTIONS-XML-PROCESSING-
see "mydefns".

This will work:

select xpath(
'/junos:chassis-inventory/junos:chassis/junos:serial-number/text()',
data_xml,
ARRAY[ARRAY['junos', 'http://xml.juniper.net/junos/9.6R4/junos-chassis'
]]
)
from xml_test;

cheers, Filip

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Filip Rembiałkowski 2011-09-23 19:18:09 Re: a spatial table's bounding box
Previous Message Thomas Kellerer 2011-09-23 06:37:05 Re: using the aggregate function max()