How can I convert a nested XML file into a table using postgresql?



I need to convert a nested XML into postgres database, but have no idea how. An example of this file is as follows:



<root>
<log>
<order>0</order>
<location>90<location>
</log>
<alarm_info>
<pos>
<name>NE</name>
</pos>
<pos>
<name>NE-101.1</name>
<alarm>
<offset>10</offset>
<local>42</local>
<area>18</area>
</alarm>
</pos>
<pos>
<name>NE-101.2</name>
<alarm>
<offset>10</offset>
<local>42</local>
<area>18</area>
</alarm>
</pos>
</alarm_info>
</root>


I know postgres has XML built in functions, but none of these are helping with the nested XML. Any help is really appreciated.


No comments:

Post a Comment