Re: xpath query

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rita <rmorgan466(at)gmail(dot)com>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: xpath query
Date: 2017-01-25 15:29:46
Message-ID: CAKFQuwYGZuemzWhEUJPHXmUyCgyD-Wb4q9MTZkL8U7ZA0x_1Dg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Tue, Jan 24, 2017 at 7:02 PM, Rita <rmorgan466(at)gmail(dot)com> wrote:

>
> Using postgresql latest for a project.
>
> I have a XML document which I would like to store in a table and query it
> using xpath function.
>
> My document looks like this:
>
> <ca>
> <c>
> <a n="color"><s>red</s></a>
> <a n="year"><i>1995</i></a>
> </c>
> </ca>
>
> How can I extract color. expected value is "red"
>

​https://www.postgresql.org/docs/9.6/static/functions-xml.html

> Also, is it better to dump the data into a table and then use some sort of
> trigger to parse it into a more normalized format for querying or is it
> better to to leave it as a XML dump and have the application handle the XML
> parsing?
>

It depends.

David J.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message padmini 2017-01-26 17:25:48 Re: Postgres authentication to multiple application servers
Previous Message Moreno Andreo 2017-01-25 10:53:29 Re: Postgres authentication to multiple application servers