Skip to content

Instantly share code, notes, and snippets.

@edeustace
Created December 26, 2013 14:20
Show Gist options
  • Save edeustace/8134370 to your computer and use it in GitHub Desktop.
Save edeustace/8134370 to your computer and use it in GitHub Desktop.
scala remove namespaces
val xml = <item name="ed" test="true"
xmlns="http://www.somenamespace.com"
xmlns:xsi="http://www.somenamespace.com/XMLSchema-instance">
<blah>
<node>value</node>
</blah>
</item>
import scala.xml._
def clearScope(x: Node):Node = x match {
case e:Elem => e.copy(scope=TopScope, child = e.child.map(clearScope))
case o => o
}
val out = clearScope(xml)
println(out.toString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment