[GeoNetwork-users] parse xml data from postgresql

Dear all,

I would like to automatically extract the title and abstract of each metadata from the 'data' colum in 'metadata' table of PostgreSQL/PostGIS. The idea is to browse the spatial index in a similar way than this (http://trac.osgeo.org/geonetwork/wiki/HowToViewSpatialIndexUsingGeoServerWMS), but including title and abstract in the popup template.
My initial approach would be to create a trigger with a function that parses the XML for every insert or update. However, I have no experience in parsing XML within PostgreSQL. I'm wondering if anyone has already done something similar or created a function that could help to achieve this.

Best regards,
David

--
David March Morlà
PhD candidate
Fisheries-GIS Spatial Ecologist
Email: david@anonymised.com

IMEDEA
Instituto Mediterraneo de Estudios Avanzados (UIB-CSIC)
C/Miquel Marquès 21, 07190 Esporles, Balearic Islands. Spain
www.imedea.uib.es

SOCIB
Balearic Islands Coastal Observing and Forecasting System
Strategic Issues and Applications for Society (SIAS Division)
Parc Bit, Naorte, Bloc A 2ºp. pta. 3, 07121 Palma de Mallorca. Spain
Tel: +034 971 43 99 98
www.socib.es

-----Original Message-----
From: David March Morla [mailto:david@anonymised.com]
Sent: Tuesday, 22 March 2011 05:37
To: Geonetwork list
Subject: [GeoNetwork-users] parse xml data from postgresql

Dear all,

I would like to automatically extract the title and abstract
of each metadata from the 'data' colum in 'metadata' table of
PostgreSQL/PostGIS. The idea is to browse the spatial index
in a similar way than this
(http://trac.osgeo.org/geonetwork/wiki/HowToViewSpatialIndexUs
ingGeoServerWMS),
but including title and abstract in the popup template.
My initial approach would be to create a trigger with a
function that parses the XML for every insert or update.
However, I have no experience in parsing XML within
PostgreSQL. I'm wondering if anyone has already done
something similar or created a function that could help to
achieve this.

FYI if your PostgreSQL install is built with libxml2, you can use the
xpath function. See
http://developer.postgresql.org/pgdocs/postgres/functions-xml.html for
more details.

..Tom