help with pgxml_xpath

From: "Jeff MacDonald" <jeff(at)interchange(dot)ca>
To: "Postgres List" <pgsql-general(at)postgresql(dot)org>
Subject: help with pgxml_xpath
Date: 2002-10-21 14:59:21
Message-ID: HJEPJELDKPJEEIIFNLNHEEDOCAAA.jeff@interchange.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I have a table where a typical query looks like this.

cfm=> SELECT loginid,userdata FROM urdr_users where id = 110;
loginid | userdata
---------+---------------------------------------------
110 | <opt dob="1900-01-01" dft_entityid="74" />

I need to extract the dft_entityid from the xml, i've done this.

cfm=> SELECT loginid,pgxml_xpath(userdata,'//@dft_entityid/','','') FROM
urdr_users where id = 110;
loginid | pgxml_xpath
---------+--------------------
110 | dft_entityid="74"

That is as close as i can get.. I'd like to be able to extract just the 74.

Any help would be greatly appreciated.

Thanks.

Jeff.

Browse pgsql-general by date

  From Date Subject
Next Message darthxiong 2002-10-21 15:00:12 plpgsql and escape
Previous Message Nigel J. Andrews 2002-10-21 14:56:48 Re: referential integrity violation