In my C# codebase, I have an XDocument
of the form:
<A>
<B>
<C xmlns='blabla' yz='blablaaa'> Hi </C>
<D xmlns='blabla' yz='blablaaa'> How </D>
<E xmlns='blabla' yz='blablaaa'> Are </E>
<F xmlns='blabla' yz='blablaaa'> You </F>
</B>
<B>
<C xmlns='blabla' yz='blablaaa'> I </C>
<D xmlns='blabla' yz='blablaaa'> am</D>
<E xmlns='blabla' yz='blablaaa'> fine</E>
<F xmlns='blabla' yz='blablaaa'> thanks</F>
</B>
Using Linq-to-XML or otherwise, I wanted to remove the xmlns
for all the elements contained by element B.
Using the methodology given here: How to Remove specific attributes in XMLDocument?, I was able to remove all attributes except xmlns
What is the best way to remove 'xmlns' attribute from XDocument
?