I am looking for the clean, elegant and smart solution to remove namespacees from all XML elements? How would function to do that look like?
Defined interface:
Here is a regex based solution to this problem...
private XmlDocument RemoveNS(XmlDocument doc) { var xml = doc.OuterXml; var newxml = Regex.Replace(xml, @"xmlns[:xsi|:xsd]*="".*?""",""); var newdoc = new XmlDocument(); newdoc.LoadXml(newxml); return newdoc; }