Below code gives this error message “Specified method is not supported”. But here is sample which is same with mine.
FileInfo file = new FileInfo("../../file.xml");
XDocument xfile = XDocument.Load(file.FullName);
XPathNavigator nav = xfile.CreateNavigator();
nav.AppendChild("<pages>100</pages>");
When you create an
XPathNavigatorfrom an XML source object, the navigator ultimately calls back into the original object to read its data and make its changes. The code sample you provided is not the same as the one you link to, because they are creating theXPathNavigatorfrom anXmlDocument, which is read-write. You are creating one from anXDocument, which is read-only.Each type of XML object returns its own version of an
XPathNavigator, which is limited by the capabilities of the object it came from.