XDocument or XmlDocument

前端 未结 7 2013
灰色年华
灰色年华 2020-11-22 02:48

I am now learning XmlDocument but I\'ve just ran into XDocument and when I try to search the difference or benefits of them I can\'t find something useful, could you please

7条回答
  •  遇见更好的自我
    2020-11-22 03:29

    XmlDocument is great for developers who are familiar with the XML DOM object model. It's been around for a while, and more or less corresponds to a W3C standard. It supports manual navigation as well as XPath node selection.

    XDocument powers the LINQ to XML feature in .NET 3.5. It makes heavy use of IEnumerable<> and can be easier to work with in straight C#.

    Both document models require you to load the entire document into memory (unlike XmlReader for example).

提交回复
热议问题