What is difference between XElement and XDocument?
Ans. XElement and XDocument are the classes defined with in System.Xml.Linq namespace. XElement class
represents an XML fragment. While XDocument class represents an entire XML document with all associated
properties.
For Example:
XDocument doc = new XDocument(new XElement( "Book",
new XElement( "Name", ".NET Interview FAQ" ),
new XElement( "Author" , "Shailendra Chauhan" ))
);
Ans. XElement and XDocument are the classes defined with in System.Xml.Linq namespace. XElement class
represents an XML fragment. While XDocument class represents an entire XML document with all associated
properties.
For Example:
XDocument doc = new XDocument(new XElement( "Book",
new XElement( "Name", ".NET Interview FAQ" ),
new XElement( "Author" , "Shailendra Chauhan" ))
);
Comments
Post a Comment