locked
System.Xml.Linq.Xdocument Save method does not supporting string file path parameter in my windows machine RRS feed

  • Question

  • User25800215 posted

    I am trying to save xml file using string parameter as file path, it is not saying Invalid parameter in my windows8 machine.

    Intellegence is listed only 5 overloaded method which does not have a option with string param where MSDN articles are showing that around 7 overloading methods which includes string prameter along with saving options.

    Xdocument xdoc = new Xdocument();

    xdoc = Xdocument.Load(Path); ---Path has physical file path

    .........code logic goes here...

    xdoc.Save(Path);----Throwing complie error sayign invalid parameters.....

    Namespace: System.Xml.Linq

    Note:And I am using .Net portable class library

    Any help is well appreciated.

    Saturday, February 15, 2014 12:51 AM

All replies

  • User-484054684 posted

    Hope the variable 'Path' is of type string.

    So, essentially you should have been using the overload method mentioned here: http://msdn.microsoft.com/en-us/library/bb345830%28v=vs.110%29.aspx

    There is one catch in it - this method seems to be available from .NET framework 3.5, 4 and 4.5 only. So you may need to cross check if your framework version is with in this range.

    Hope this helps.

    Saturday, February 15, 2014 4:14 AM
  • User832087614 posted

    Check what is there in Path at the time of runtime...copy that value and go to "start", click on Run and paste your copied path....check if it is pointing right location.

    Tuesday, April 8, 2014 11:42 PM