XDocument represents a whole XML document. It is normally composed of a number of elements.
XElement represents an XML element
Both are the classes defined by System.Xml.Linq namespace
XElement class
represents an XML fragment
XDocument class represents an entire XML document with all associated meta-data.
example:
XDocument d = new XDocument(
new XComment("hello"),
new XElement("book",
new XElement("bookname", "ASP.NET"),
new XElement("authorname", "techmedia"),
)
);
No comments:
Post a Comment