Created
December 26, 2013 14:20
-
-
Save edeustace/8134370 to your computer and use it in GitHub Desktop.
scala remove namespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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