Thread: Howto convert / (re)store xml column to table in trigger using contrib/xml2?

Howto convert / (re)store xml column to table in trigger using contrib/xml2?

From
Joost Kraaijeveld
Date:
Hi,

Is it possible to convert / (re)store a column that contains xml (see
below) into real table in a trigger, using contrib/xml2?

The reason is that an application stores a xml blob in a column but we
need the data in a real table for a third party report generator. So I
want to use a trigger that, upon insert, update or delete, moves the
data into that table.

The XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<data><field>    <name>field1</name>    <value>value1</value></field><field>    <name>field2</name>
<value>value2</value></field>
</data>

And I have a table with the (text) columns field1 and field2.

Any pointers to a solution is really appreciated (solutions also ;-))

TIA


-- 
Groeten,

Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
web: www.askesis.nl