XML2 module and xpath_table

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема XML2 module and xpath_table
Дата
Msg-id g10s5r$o3q$1@ger.gmane.org
обсуждение исходный текст
Ответы Re: XML2 module and xpath_table
Список pgsql-general
Hi,

I am using xpath_table to convert elements from an XML column to "rows".

Now according to
http://www.postgresql.org/docs/8.3/static/xml2.html
this function will be removed in a future version.

That chapter also claims that the new XML syntax covers the functionality of the xml2 module, but I cannot find a way
toreturn the elements of an XML document as rows (as xpath_table does) 

Suppose I have the following content in my xml column:

<team>
 <member id="10" name="Arthur Dent"/>
 <member id="11" name="Ford Prefect"/>
</team>


I am using a statement similar to this:

select member_id, member_name
from xpath_table('id', 'xml_text', 'xmltest', '/team/member/@id|/team/member/@name', 'true')
as t(id integer, member_id varchar, member_name varchar)

to get the following output

member_id    member_name
10    Arthur Dent
11    Ford Prefect

How would I achieve the same without using the deprecated xml2 module?

Thanks in advance
Thomas

В списке pgsql-general по дате отправления:

Предыдущее
От: "J. Manuel Velasco - UBILIBET"
Дата:
Сообщение: Re: how to modify a view
Следующее
От: Maarten Deprez
Дата:
Сообщение: Re: escaping and quoting