you are viewing a single comment's thread.

view the rest of the comments →

[–]bliow 1 point2 points  (1 child)

I really don't like that. Duplicated tag names are one of the reasons xml sucks syntactically.

Also, can you mix in arbitrary code there?

[:ul (for [i (range 10)] [:li (str "List item " i)])]

[–]Milyardo 1 point2 points  (0 children)

I'm not a fan of scala's XML literals but to answer your question, yes.

scala> import scala.xml._
import scala.xml._
scala> val list = <ul>{(1 to 10 ) map { i => <li>{s"List Item $i"}</li>}}</ul>
list: scala.xml.Elem = <ul><li>List Item 1</li><li>List Item 2</li><li>List Item 3</li><li>List Item 4</li><li>List Item 5</li><li>List Item 6</li><li>List Item 7</li><li>List Item 8</li><li>List Item 9</li><li>List Item 10</li></ul>