databricks / spark-xml

XML data source for Spark SQL and DataFrames
Apache License 2.0
499 stars 226 forks source link

Empty line between tags when writing xml #683

Closed sarg90 closed 4 months ago

sarg90 commented 4 months ago

Hi, When running below code I get an empty scape line between row tags:

data = [(1, "John"), (2, "Jane"), (3, "Jim")]

schema = StructType([ StructField("id", IntegerType(), True), StructField("name", StringType(), True) ])

df = spark.createDataFrame(data, schema)

df.coalesce(1).write \ .mode('overwrite')\ .format('com.databricks.spark.xml') \ .option('rootTag', 'root') \ .option('rowTag', 'row') \ .save(xmlFile)

Output file: image

Version is com.databricks:spark-xml_2.12:0.18.0 Am I missing a writing option to avoid this behavior?

sarg90 commented 4 months ago

Just saw your comment on issue: https://github.com/databricks/spark-xml/issues/676 I agree it shouldnt be a big problem but it sure ringed a bell. Thanks for the explanation. I will close the issue for now.