I am having serious trouble adding an XElement after loading that inherits the parent's namespace... I've tried multiple examples, set the exact same namespaces in both documents, tried removing the namespaces... this is honestly a mess, the only example I found was re-creating the XElement object with a namespace in the constructor but my XML is pretty massive. I do not wish to do this. Is there a way to Inherit namespaces after a load then add to parent (see code for example of what I mean).
xml = XDocument.Load(rdlFile);
var selectNode = xml.AssumeISelectedTheNodeIWantWithLinq();
//A static element loaded from a separate file
XElement elementNeedsNameSpace = XElement.Load("element.xml");
selectNode.Add(elementNeedsNameSpace );
//Output xml:
<MyAddedNode xmlns="">
<AssumeLotsOfChilds>
<SubChilds/>
</AssumeLotsOfChilds>
</MyAddedNode>
//Root xml
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
If I remove the attribute then I get all the children messed up and receive the stupid xlmns="" :(