Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > xpath_table
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 3467 of 3799
Post > Topic >>

xpath_table

by spam_eater@[EMAIL PROTECTED] (Thomas Kellerer) May 15, 2008 at 01:37 PM

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 to return the elements of an
XML do***ent 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/@[EMAIL PROTECTED]
|/team/member/@[EMAIL PROTECTED]
', '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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
 




 1 Posts in Topic:
xpath_table
spam_eater@[EMAIL PROTECT  2008-05-15 13:37:34 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:38:44 CST 2008.