Dear All,by using Linq,i,m adding some of the nodes to the xml :
XDocument xdoc = new XDocument(new XDeclaration("1", "utf-8", "yes"),
new XComment("XML data manipulation using Linq"),
new XProcessingInstruction("Instruction", "2333"),
new XElement("Subjects",
new XElement("Subject",
new XElement("Physics", "Good"),
new XElement("maths", "Excellent")
)));
xdoc.Save(@"C:\data.xml");//in this line it was showing an error that the best overloaded method match for system.xml.linq.xdocument.save(system.xml.xmlwriter) has some invalid arguments.How can i solve this problem?
Thanks in advance.
Loading
VulpesPosted Jul 28, 2011, 7:00 AM
See (http://msdn.microsoft.com/en-us/library/system.windows.controls.savefiledialog(VS.95).aspx).
To get the XDocument into string form prior to saving just do:
string xml = xdoc.ToString();
maheshPosted Jul 28, 2011, 12:13 AM
VulpesPosted Jul 27, 2011, 4:48 AM
The overloads of XDocument.Save which save to the file system are not supported with that.
VulpesPosted Jul 27, 2011, 4:39 AM
The compiler must choose the overload which saves to a file
So, I'm intrigued - are you absolutely sure that the error is occurring on that particular line?
Suthish NairPosted Jul 27, 2011, 1:56 AM