Data in a table called 'equipment_group' (eg) contains various equipment categories:
bakeware
cookware
kitchenware
utensils
cookware
kitchenware
utensils
I would like to use these values as elements within an XML document. Something like:
xmlelement( name eg.label )
Each of these data element can have multiple objects, as shown in the following XML snippet:
<equipment>
<bakeware>
<object min-quantity="20">ramekin</object>
<object min-quantity="2" alias="pan">shallow baking pan</object>
</bakeware>
<cookware>
<object min-quantity="1" alias="pot">medium pot</object>
</cookware>
<utensils>
<object alias="torch">kitchen butane torch</object>
<object alias="sieve">fine-mesh sieve</object>
<object alias="whisk">wire whisk</object>
</utensils>
</equipment>
<bakeware>
<object min-quantity="20">ramekin</object>
<object min-quantity="2" alias="pan">shallow baking pan</object>
</bakeware>
<cookware>
<object min-quantity="1" alias="pot">medium pot</object>
</cookware>
<utensils>
<object alias="torch">kitchen butane torch</object>
<object alias="sieve">fine-mesh sieve</object>
<object alias="whisk">wire whisk</object>
</utensils>
</equipment>
In PostgreSQL 9.1, I do not see an XML function that allows XML element creation based on row data. It seems the row data is always used as the values for elements.
How do you create XML elements using names stored as row data?
Thank you!