Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group