Ich habe etwas XML mit eingebettetem Scala generiert, aber es legt das generierte XML nicht in separate Zeilen.Erzeugen von formatiertem XML in Scala
Derzeit sieht es so aus,
<book id="0">
<author>Gambardella, Matthew</author><publish_date>Sun Oct 01 00:00:00 EDT 2000</publish_date><description>An in-depth loo
k at creating applications with XML.</description><price>44.95</price><genre>Computer</genre><title>XML Developer's Guide</title>
</book>
aber ich will es so aussehen:
<book id="0">
<author>Gambardella, Matthew</author>
<publish_date>Sun Oct 01 00:00:00 EDT 2000</publish_date>
<description>An in-depth look at creating applications with XML.</description>
<price>44.95</price>
<genre>Computer</genre>
<title>XML Developer's Guide</title>
</book>
Wie kann ich die Formatierung steuern? Hier ist der Code, der die XML-
<book id="0">
{ keys map (_.toXML) }
</book>
hier erzeugt ist ToXml:
def toXML:Node = XML.loadString(String.format("<%s>%s</%s>", tag, value.toString, tag))
Mögliche Duplikate von [Wie schön formatiert XML in Scala?] (Http://stackoverflow.com/questions/3364627/how-to-produce-nicely-formatted-xml -in-scala) – Suma