'How to convert XSD schema to Pyspark schema

I am using databricks/spark-xml jar file for reading XML file. And I am not able to convert XSD schema file to Pyspark schema.

We can convert json schema to Pyspark schema using

schema = StructType.fromJson(json_dict_or_list)

But I am not able to do for XSD schema file. I was expecting i will be reading XSD file and convert it into pyspark schema.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source