I have a huge xml file that I cannot open unless I import it into a database. I am using Postgres for this. I have a schema that goes with this data file. There are too many columns so i'd like to automate the process of creating a table from this schema and then importing the data file from the local drive on my computer to populate this table. How do i do this? I saw a lot of answers on SO but haven't been able to understand this correctly. Also I do not have superuser rights so will have to work around that.
Here's what the schema file looks like:
> <?xml version="1.0" encoding="UTF-8"?> <xs:schema
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified"
> targetNamespace="http://www.drugbank.ca" xmlns="http://www.drugbank.ca">
> <xs:element name="drugbank" type="drugbank-type">
> <xs:annotation>
> <xs:documentation>This is the root element for the DrugBank database schema. DrugBank is a database on drug and
> drug-targets.</xs:documentation>
> </xs:annotation>
> </xs:element>
> <xs:complexType name="drugbank-type">
> <xs:annotation>
> <xs:documentation>This is the root element type for the DrugBank database schema.</xs:documentation>
> </xs:annotation>
> <xs:sequence>
> <xs:element name="drug" type="drug-type" maxOccurs="unbounded"/>
> </xs:sequence>
> <xs:attribute name="version" type="xs:string" use="required">
> <xs:annotation>
> <xs:documentation>The DrugBank version for the exported XML file.</xs:documentation>
> </xs:annotation>
> </xs:attribute>
> <xs:attribute name="exported-on" type="xs:date" use="required">
> <xs:annotation>
> <xs:documentation>The date the XML file was exported.</xs:documentation>
> </xs:annotation>
> </xs:attribute>
> </xs:complexType>
> <xs:complexType name="drug-type">
> <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="1" name="drugbank-id"
> type="drugbank-drug-salt-id-type"> </xs:element>
> <xs:element name="name" type="xs:string"/>
> <xs:element name="description" type="xs:string"/>
> <xs:element name="cas-number" type="xs:string"/>
> <xs:element name="unii" type="xs:string"/>
> <xs:element name="average-mass" type="xs:float" minOccurs="0"/>
> <xs:element name="monoisotopic-mass" type="xs:float" minOccurs="0"/>
> <xs:element name="state" type="state-type" minOccurs="0"/>
> <xs:element name="groups" type="group-list-type"/>
> <xs:element name="general-references" type="reference-list-type"/>
> <xs:element name="synthesis-reference" type="xs:string"/>
> <xs:element name="indication" type="xs:string"/>
> <xs:element name="pharmacodynamics" type="xs:string"/>
> <xs:element name="mechanism-of-action" type="xs:string"/>
> <xs:element name="toxicity" type="xs:string"/>
> <xs:element name="metabolism" type="xs:string"/>
> <xs:element name="absorption" type="xs:string"/>
> <xs:element name="half-life" type="xs:string"/>
> <xs:element name="protein-binding" type="xs:string"/>
> <xs:element name="route-of-elimination" type="xs:string"/>
> <xs:element name="volume-of-distribution" type="xs:string"/>
> <xs:element name="clearance" type="xs:string"/>
> <xs:element name="classification" type="classification-type" minOccurs="0"/>
> <xs:element name="salts" type="salt-list-type"/>
> <xs:element name="synonyms" type="synonym-list-type"/>
> <xs:element name="products" type="product-list-type"/>
> <xs:element name="international-brands" type="international-brand-list-type"/>
> <xs:element name="mixtures" type="mixture-list-type"/>
> <xs:element name="packagers" type="packager-list-type"/>
> <xs:element name="manufacturers" type="manufacturer-list-type"/>
> <xs:element name="prices" type="price-list-type"/>
> <xs:element name="categories" type="category-list-type"/>
> <xs:element name="affected-organisms" type="affected-organism-list-type"/>
> <xs:element name="dosages" type="dosage-list-type"/>
> <xs:element name="atc-codes" type="atc-code-list-type"/>
> <xs:element name="ahfs-codes" type="ahfs-code-list-type"/>
> <xs:element name="pdb-entries" type="pdb-entry-list-type"/>
> <xs:element name="fda-label" type="xs:anyURI" minOccurs="0"/>
> <xs:element name="msds" type="xs:anyURI" minOccurs="0"/>
> <xs:element name="patents" type="patent-list-type"/>
> <xs:element name="food-interactions" type="food-interaction-list-type"/>
> <xs:element name="drug-interactions" type="drug-interaction-list-type"/>
> <xs:element minOccurs="0" name="sequences" type="sequence-list-type"/>
> <xs:element minOccurs="0" name="calculated-properties" type="calculated-property-list-type"/>
> <xs:element name="experimental-properties" type="experimental-property-list-type"/>
> <xs:element name="external-identifiers" type="external-identifier-list-type"/>
> <xs:element name="external-links" type="external-link-list-type"/>
> <xs:element name="pathways" type="pathway-list-type"/>
> <xs:element name="reactions" type="reaction-list-type"/>
> <xs:element name="snp-effects" type="snp-effect-list-type"/>
> <xs:element name="snp-adverse-drug-reactions" type="snp-adverse-drug-reaction-list-type"/>
> <xs:element name="targets" type="target-list-type"/>
> <xs:element name="enzymes" type="enzyme-list-type"/>
> <xs:element name="carriers" type="carrier-list-type"/>
> <xs:element name="transporters" type="transporter-list-type"/>
> </xs:sequence>
This is only a part of it. It's a huge file. Any kind of help/guidance is much appreciated.