I have a Postgres table where i have information about some products in each columns, Now i need to generate a XML file from that PostgreSQL database in the below format.
The column names of the PostgreSQL DB is same as that of the XML attributes.
Python : 3.5, PostgreSQL Version 11
<rss xmlns:g="http://base.google.com/ns/1.0" version="2.0" encoding="utf-8">
<config>
<g:system>Magento</g:system>
<g:extension>Magmodules</g:extension>
<g:extension_version>1.6.8</g:extension_version>
<g:store>store_1</g:store>
<g:url>https://www.company.com/</g:url>
<g:products>1315</g:products>
<g:generated>2020-06-05 06:05:15</g:generated>
<g:processing_time>12.5524</g:processing_time>
</config>
<channel>
<item>
<g:id>20</g:id>
<g:title>tablet 509</g:title>
<g:description>description about tablet 504</g:description>
<g:gtin>4261562</g:gtin>
<g:brand>New brand</g:brand>
<g:mpn>0014</g:mpn>
<g:link>
https://www.company.com/tablet_504.html
</g:link>
<g:image_link>
https://www.company.com/tablet_504/product/c/a/cat_21_16.jpg
</g:image_link>
<g:availability>in stock</g:availability>
<g:condition>new</g:condition>
<g:category_path>Health > Tablets</g:category_path>
<g:product_type>-- Please Select --</g:product_type>
<g:google_product_category/>
<g:price>9.90 </g:price>
<g:shipping>
<g:country>USA</g:country>
<g:service>DHL</g:service>
<g:price>2.90 </g:price>
</g:shipping>
</item>
<item>
<g:id>21</g:id>
<g:title>Tablet 1000 C</g:title>
<g:description>Description about Tablet 1000 C</g:description>
<g:gtin>41381</g:gtin>
<g:brand>New Brand</g:brand>
<g:mpn>0015</g:mpn>
<g:link>
https://www.company.com/tablet-1000-C.html
</g:link>
<g:image_link>
https://www.company.com/tablet-1000-C/product/t/e/1000_c.jpg
</g:image_link>
<g:availability>in stock</g:availability>
<g:condition>new</g:condition>
<g:category_path>Health > Tablets</g:category_path>
<g:product_type>Vitamin B7</g:product_type>
<g:google_product_category/>
<g:price>8.90</g:price>
<g:shipping>
<g:country>USA</g:country>
<g:service>DHL</g:service>
<g:price>2.90</g:price>
</g:shipping>
</item>
</channel>