xml build a list of all elements

From: ft <ml(at)ft-c(dot)de>
To: pgsql-sql(at)lists(dot)postgresql(dot)org
Subject: xml build a list of all elements
Date: 2024-03-26 21:04:55
Message-ID: 2c00e954c31459c43f0d78119c1bd0547f7eddb2.camel@ft-c.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello, 

I have a postgresql database table with xml data. 
What I need is a list of all elements and attributes.
Example:
<area>
<sub>
<sub2 attr='1'>comment</sub2>
<sub2 attr='2'>comment</sub2>
<sub>
</area>

The result should be:
/area
/area/sub
/area/sub/sub2
/area/sub/sub2(at)attr
/area/sub/sub2
/area/sub/sub2(at)attr

or distinct (it's enough)
/area
/area/sub
/area/sub/sub2
/area/sub/sub2(at)attr

Is there a postgresql function to build this list?

Franz

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Midgley 2024-03-26 22:27:27 Re: xml build a list of all elements
Previous Message Tom Lane 2024-03-25 16:26:43 Re: Get error when calling function that returns a table