| From: | Viktor Bojović <viktor(dot)bojovic(at)gmail(dot)com> |
|---|---|
| To: | Markus Schatten <markus(dot)schatten(at)foi(dot)hr> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: get attribute from XML |
| Date: | 2010-10-12 07:10:06 |
| Message-ID: | AANLkTimCPxFSWWdpr+YOf_DvWcV45sKwmzTvJuGgSc_S@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
Dear Markus,
it works now. Thanx.
On Tue, Oct 12, 2010 at 2:22 AM, Markus Schatten <markus(dot)schatten(at)foi(dot)hr>wrote:
> Dear Viktor,
>
> 'modified' is an attribute node, so you need to use the @ sign to
> acquire its value:
>
> mschatte=# select xpath( '//entry/@modified', '<entry version="21"
> modified="2009-07-07" dataset="S" created="2009-06-16" />' );
> xpath
> --------------
> {2009-07-07}
> (1 row)
>
> HTH
>
> M.S.
>
> On Tue, Oct 12, 2010 at 1:03 AM, Viktor Bojović
> <viktor(dot)bojovic(at)gmail(dot)com> wrote:
> > Hi,
> > while parsing this type of XML:
> > <entry version="21" modified="2009-07-07" dataset="S"
> created="2009-06-16">
> > <accession>Q91G55</accession>
> >
> > i tried this query to get the modified attribute
> > select xpath('//entry/modified/text()',xml) from xml_sprot limit 10;
> > but it doesn't work.
> > So im asking if anyone can help me with that.
> > Thanx in advance
> > --
> > ---------------------------------------
> > Viktor Bojović
> > ---------------------------------------
> > Wherever I go, Murphy goes with me
> >
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
--
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Pavel Stehule | 2010-10-12 09:01:20 | Re: Is there a conditional string-concatenation ? |
| Previous Message | Osvaldo Kussama | 2010-10-12 05:03:41 | Re: Is there a conditional string-concatenation ? |