Based on the article you referenced:
Easy Method to Split Large XML File Using LINQ to XML[
^]...
All you need to do is to call
RemoveAllNamespaces
function passing
c1
variable into it:
private static XElement RemoveAllNamespaces(XElement xmlDocument)
{
if (!xmlDocument.HasElements)
{
XElement xElement = new XElement(xmlDocument.Name.LocalName);
xElement.Value = xmlDocument.Value;
foreach (XAttribute attribute in xmlDocument.Attributes())
xElement.Add(attribute);
return xElement;
}
return new XElement(xmlDocument.Name.LocalName, xmlDocument.Elements().Select(el => RemoveAllNamespaces(el)));
}
Above function comes from:
http://stackoverflow.com/questions/987135/how-to-remove-all-namespaces-from-xml-with-c[
^]
I'd call it this way:
XElement frag = new XElement(rootElement, RemoveAllNamespcaes(c1));