If you have something like:
val myStuff = Array(Person('joe',40), Person('mary', 35))
How do you create an XML value with that data as nodes? I know how to use { braces } in an XML expression to put a value, but this is a collection of values. Do I need to iterate explicitly or is there something better?
val myXml = <people>{ /* what here?! */ }</people>
The resulting value should be something like:
<people><person><name>joe</name><age>40</age></person> <person><name>mary</name><age>39</age></person></people>
As it’s a functional programming language Array.map is probably what you’re looking for:
Results in:
A formatted result (for a better read):