Skip to content

PrettyPrinter(minimizeEmpty = true) injects a new line into elements with attributes #231

Closed
@hosamaly

Description

@hosamaly

Using scala-xml v1.1.0, pretty-printing a leaf node with attributes when minimizeEmpty is set to true injects a new line into the element:

scala> new scala.xml.PrettyPrinter(width = 4, step = 2, minimizeEmpty = true).format(<a b="c"/>)
res0: String =
"<a
b="c">
</a>
"

scala> scala.xml.XML.loadString(res0).child.map(_.getClass.getName)
res2: scala.collection.immutable.Seq[String] = List(scala.xml.Text)

This behaviour renders the XML invalid if the schema dictates a non-mixed element.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions