import scala.collection.mutable import scala.xml.{PCData, XML} val currentDirectory = new java.io.File(".").getCanonicalPath //val xml = XML.loadFile("../src/test/resources/sample-metadata.xml") val xml = b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984 published true 1504122319984 1504122655395 4 false Prueba 2 https://demo.bigbluebutton.org/b/rooms/vi-249c619c/Prueba%202/callback vi-249c619c Prueba 2 vi-249c619c-Prueba 2 5bd0e35013bc9761d06f01d4bfd9b4ae1c8df289 false presentation https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984 10915 105862 Welcome tohttps://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-1.png (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-2.png (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-3.png 531235 493084 val asdf = xml \ "meta2" asdf.isEmpty val id = (xml \\ "id").text val state = (xml \\ "state").text val published = (xml \\ "published").text.toBoolean val format = (xml \\ "playback" \\ "format").text val meta = (xml \ "meta")(0) val foo = meta.nonEmptyChildren println(foo.length) val foo1 = foo filter (p => p.label != "#PCDATA") val baz = foo1 map { f => f.label -> f.text } toMap baz.size val playback = xml \ "playback" val extensions = playback \ "extensions" val preview = extensions \ "preview" val imagesNodes = preview \ "images" val images = (imagesNodes \ "image") .map { n => val w = (n \ "@width").text val h = (n \ "@height").text val alt = (n \ "@alt").text val link = (n.text) new MetaImage(w, h, alt, link) } val x = new scala.xml.NodeBuffer images foreach { im => x += {im.alt}{im.link} } val imageElem = {x} println(imageElem) case class MetaImage(width: String, height: String, alt: String, link: String)