Pulling out XML attribute information in Scala
I'm trying to iterate over all the attributes in a scala.xml.Elem
and get the namespace, attribute name and value as a String. I've found it a bit hard going to be honest; is there a better way to do it than:
elem.attributes map { md => (md.getNamespace(elem), md开发者_如何转开发.key, md.value(0).text) }
I don't think there is a better way to do this. If you need to extract data from MetaData objects a lot, you could write your own extractor to get nicer syntax.
精彩评论