I need to manipulate some xml files using Linq to xml.
I have an existing XDocument that I Load
Now I cannot seem to be able to add a namespace to it.
I do:
//Load an existing xml into a XDocument
XDocument xdoc=XDocument.Load(myXml);
//Create a namespace
XNamespace myNS="http://www.w3.org/2001/XMLSchema-instance/MyShinyNewNamespace";
xAttribute myAttr=new XAttribute(XNamespace.Xmlns +"myNS",myNS);
//Add new namepsace to root
xdoc.Root ????
What do you do here?
How do I retrieve my namespace?
How do I Remove/Replace?