I was trying to load XML files using DataBricks Spark XML. I am able to load the data properly, but I need to change the name of one of the column and put it as a separate tag inside the schema. Basically, there are few tags which need to be generated as null which is not coming in the data.( These fields are in an XSD).
Example:-
root
First Tag
Element Name
Second Tag ( Tag To Change)
Tag3
Tag4
I need to change to
root
First Tag
Element Name
Second Tag
Tag3
Tag4
Third Tag
Tag3
Tag4
I have tried many ways:- ( I cannot add schema manually).
- withColumn.- > ( With this option I am able to add a new column but at the root level, I need to add it to a definite hierarchy.)
- withColumnRenamed -> ( This option does not change anything).
Any help is appreciated!