XML : Convert XSD to Python Class Runtime

I need to convert XSD to python class while execute program.

Why I need it:

To generate XML feed we are using python class, python class is generated from XSD file and XSD files are frequently updated.

So we need such dynamic mechanism to generate python class from XSD at runtime, but I don't know how to do ?

For static conversion there are many helps available but for runtime conversion there is no help available.

Sample XSD:

  <?xml version="1.0" encoding="utf-8"?>  <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">    <xs:element name="Address">      <xs:complexType>        <xs:sequence>          <xs:element name="Name" type="xs:string" />          <xs:element name="Title" type="xs:string" />          <xs:element name="Street" type="xs:string" />          <xs:element name="City" type="xs:string" />          <xs:element name="County" type="xs:string" minOccurs="0" />          <xs:element name="Zip" type="xs:string" />          <xs:element name="Country" minOccurs="0">            <xs:simpleType>              <xs:restriction base="xs:string">                <xs:enumeration value="IN" />                <xs:enumeration value="DE" />                <xs:enumeration value="UK" />                <xs:enumeration value="US" />              </xs:restriction>            </xs:simpleType>          </xs:element>        </xs:sequence>      </xs:complexType>    </xs:element>  </xs:schema>    

To convert XSD to python I follow this link it works fine for static use, but we need to convert XSD to python runtime.

How to convert XSD to Python Class

Any help would be appreciated.

No comments:

Post a Comment