cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

scala-xml : how to move child to another parent node

RobsonNLPT
Contributor III

Hi all

The mandatory rowTag for writing to XML cause doesn't make any sense as I have the complete nested dataframe schema.

In my case I need to implement an extra step to remove that extra node (default: Row) after xml generation.

I need some examples using scala-xml library and Transform/RuleTransformer/RewriteRule to move child to root parent and remove the node "Row" 

Any help?

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

I just adapted the code and it worked. Thank you.

View solution in original post

2 REPLIES 2

Hi Kaniz. Thank you

Your code is not correct

command-3498107737134944:21: error: type mismatch; found : Seq[scala.xml.Node] required: scala.xml.Node def apply(xml: Node): Node = new RuleTransformer(this).transform(xml)

Can you check?

I just adapted the code and it worked. Thank you.