szymon_dybczak
Esteemed Contributor III

Hi @shubham7 ,

I don't know if I understood your requirements correctly, but maybe something like this could work for you.
I have 2 xml files in my volume, each with following structure:

<root>
  <row>
    <id>2</id>
    <value>foo2</value>
  </row>
  <row>
    <id>3</id>
    <value>bar3</value>
  </row>
</root>


<root>
  <row>
    <id>1</id>
    <value>foo</value>
  </row>
  <row>
    <id>2</id>
    <value>bar</value>
  </row>
</root>


szymon_dybczak_0-1751292958941.png

 

To load those file into single dataframe I've used following code:


df = (
    spark.read.format("xml") 
    .option("rootTag", "root") 
    .option("rowTag", "row") 
    .load("/Volumes/workspace/default/my_volume/*.xml")
)