I have some 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>
I want to go through this xml and remove all namespaces completely, no matter where they are. How would I do this with Scala?
<item name="ed" test="true">
<blah>
<node>value</node>
</blah>
</item>
I’ve been looking at RuleTransform and copying over attributes etc, but I can either remove the namespaces or remove the attributes but not remove the namespace and keep the attributes.
The tags are
Elemobjects and the namespace is controlled by thescopevalue. So to get rid of it you could use:However this is an immutable recursive structure so you need to do this in a recursive manner:
This function will copy the XML tree removing the scope on all the nodes. You may have to remove the scope from the attributes too.