Convert XML data to PostgreSQL automatic



I have one data *.xml and will downloading everyday via FTP and the data need to insert in pgsql table.Currently having problem on how to convert data automatically and how the script look like.already searching but still no blur.thanks you


XML data



<?xml version="1.0"?>
<ROOT>
<xsd:schema elementFormDefault="qualified" xmlns:sqltypes="http://ift.tt/1o3ANS9" xmlns:xsd="http://ift.tt/tphNwY" targetNamespace="STK">
<xsd:import schemaLocation="http://ift.tt/1o3ANSc"namespace="http://ift.tt/1o3ANS9"/>
<xsd:element name="row">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="application_no" nillable="1">
<xsd:simpleType>
<xsd:restriction sqltypes:sqlSortId="52" sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth"
sqltypes:localeId="1033" base="sqltypes:varchar">
<xsd:maxLength value="30"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="detail_type" nillable="1">
<xsd:simpleType>
<xsd:restriction sqltypes:sqlSortId="52" sqltypes:sqlCompareOptions="IgnoreCase sdIgnoreKanaType IgnoreWidth" sqltypes:localeId="1033" base="sqltypes:varchar">
<xsd:maxLength value="300"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<row xmlns:xsi="http://ift.tt/ra1lAU" xmlns="SK">
<application_no>123</application_no>
<detail_type>Report</detail_type>
</row>
</ROOT>


To



application_no | detail_type
----------------------------
1 | Report
---------------------------
2 | Card
---------------------------


Thank you so much for help and guide.


No comments:

Post a Comment