I have the following XML:
<TABLES>
<TABLE attrname="Red">
<ROWDATA>
<ROW Type="solid" track="0" Unit="0"/>
</ROWDATA>
</TABLE>
<TABLE attrname="Blue">
<ROWDATA>
<ROW Type="light" track="0" Unit="0"/>
<ROW Type="solid" track="0" Unit="0"/>
<ROW Type="solid" track="0" Unit="0"/>
</ROWDATA>
</TABLE>
I am using Spark and Scala. I want to read each field in the ROW tag and differentiate by the attribute names. Currently the code below just reads all the values inside the ROW tag but I want to read them based on the attribute names.
val df = session.read
.option("rowTag", "ROW")
.xml(filePath)
df.show(10)
df.printSchema()
Thanks in advance.