Wednesday, February 12, 2014

Got "Specified method is not supported" error when I try to use the xpathnavigator.setvalue()

This error occurred because of my XPathNavigator object created using XPathDocument object and it's read-only. So, XPathNavigator object has to be created form XMLDocument to edit the values using SetValue().


XPathDocument document = new XPathDocument(xmlStream);
XPathNavigator xPathNavigator = document.CreateNavigator();

Here we can get the "Specified method is not supported" error When I try to use the Setvalue() method.

To avoid this error, create navigator object using the XmlDocument .

XmlDocument doc = new XmlDocument();
doc.Load(@"{file-uri}"); 
XPathNavigator xPathNavigator = doc.CreateNavigator();

No comments:

Post a Comment