組み込みの Scala で生成された XML がありますが、生成された XML が別の行に配置されません。
現在、こんな感じで、
<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>
しかし、私はそれを次のようにしたい:
<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>
フォーマットを制御するにはどうすればよいですか? XML を生成するコードは次のとおりです。
<book id="0">
{ keys map (_.toXML) }
</book>
ここにtoXMLがあります:
def toXML:Node = XML.loadString(String.format("<%s>%s</%s>", tag, value.toString, tag))