What is the difference between xdocument and xmldocument




















So it sounds like you were using the wrong method for where your XML is. XDocument or XmlDocument. Asked 6 Months ago Answers: 5 Viewed 33 times. CreateElement "root" ; root. CreateElement "child" ; child. AppendChild child ; doc. Name , new XAttribute "lastSeen", c. Town , new XAttribute "firstline", c. AppendChild doc. This is a bit icky. XmlTextWriter and System. XmlTextReader ; this is the fastest way of reading, especially is you need to skip some data.

Use the class System. Posted Sep am Sergey Alexandrovich Kryukov. Abhinav Gauniyal Sep pm. Sergey Alexandrovich Kryukov Sep pm. You can use the class System. The instance is obtained through the factory method static System. HttpWebRequest and can bravely cast to this type. You can even add authentication and more. The code sample is here: at the end of this MSDN page. So, you can do it on the fly, without saving raw data in the file.

I hope you know enough now, please try. If you face any problem you cannot solve, your questions will be welcome. Abhinav Gauniyal Sep am. Perfect , Thanks :. Sergey Alexandrovich Kryukov Sep am. You are very welcome. Good luck, call again. Add your solution here. OK Paste as. Treat my content as plain text, not as HTML. I don't think general statements about efficiency or performance of XmlDocument versus XDocument are very meaningful.

If you want to use XPath 1. I don't understand the second paragraph of your question. It also asks about performance but I don't understand which approaches you want to compare. I belive both the document classes are using underneath navigator to select the element. So my questions are:. There's no benefit to using XPathNavigator for changing the document.

In fact, I would discourage you to do so. If you want to manipulate the document, stick to XmlDocument or XDocument. SetValue only allows string type. While XDocument. SetValue takes object. SetValue can be used to insert sub-nodes, not only strings.

You can insert an XElement, for example. As for the difference between XDocument and XmlDocument, it boils down to taste. I think the original question on the choice of XmlDocument versus XDocument for updating an xml is quite relevant.



0コメント

  • 1000 / 1000