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-1504122319984publishedtrue150412231998415041226553954falsePrueba 2https://demo.bigbluebutton.org/b/rooms/vi-249c619c/Prueba%202/callbackvi-249c619cPrueba 2vi-249c619c-Prueba 25bd0e35013bc9761d06f01d4bfd9b4ae1c8df289falsepresentation
https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984
10915105862https://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-1.pnghttps://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-2.pnghttps://demo.bigbluebutton.org/presentation/b27af2f930d418879550e09c7548d1cdd0be25cf-1504122319984/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1504122320002/thumbnails/thumb-3.png531235493084
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.link}
}
val imageElem = {x}
println(imageElem)
case class MetaImage(width: String, height: String, alt: String, link: String)