XML/XPath: Difference between revisions

Content added Content deleted
(Add XPaths corresponding to the original solution semantic)
(→‎{{header|Scala}}: Change second task to follow semantics of the original example)
Line 2,779: Line 2,779:
</item>)
</item>)


scala> xml \\ "price" foreach println
scala> xml \\ "price" map (_.text) foreach println
<price>14.50</price>
14.50
<price>23.99</price>
23.99
<price>4.95</price>
4.95
<price>3.56</price>
3.56


scala> val names = (xml \\ "name").toArray
scala> val names = (xml \\ "name").toArray