From: Viktor Bojović <viktor.bojovic@gmail.com>
To: Markus Schatten <markus.schatten@foi.hr>
Cc: pgsql-sql@postgresql.org
Subject: Re: get attribute from XML
Date: Tue, 12 Oct 2010 09:10:06 +0200
Message-ID: <AANLkTimCPxFSWWdpr+YOf_DvWcV45sKwmzTvJuGgSc_S@mail.gmail.com> (raw)
In-Reply-To: <AANLkTincUH=RzEuvzQ5BxE=_oDgWkWX9Vh8aVsHLL7L9@mail.gmail.com>
References: <AANLkTinAMcqZdCE0jvhekcH0oBMkiu-Qb4v8KJkQy5ox@mail.gmail.com>
<AANLkTincUH=RzEuvzQ5BxE=_oDgWkWX9Vh8aVsHLL7L9@mail.gmail.com>
Dear Markus,
it works now. Thanx.
On Tue, Oct 12, 2010 at 2:22 AM, Markus Schatten <markus.schatten@foi.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.bojovic@gmail.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@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
--
---------------------------------------
Viktor Bojović
---------------------------------------
Wherever I go, Murphy goes with me
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: viktor.bojovic@gmail.com, markus.schatten@foi.hr
Subject: Re: get attribute from XML
In-Reply-To: <AANLkTimCPxFSWWdpr+YOf_DvWcV45sKwmzTvJuGgSc_S@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox