
LINQ to XML Integration
.NET Language-Integrated Query for XML (LINQ to XML) allows XML data to be queried by using the standard query operators as well as tree-specific operators that provide XPath-like navigation through descendants, ancestors, and siblings. It provides an efficient in-memory representation for XML that integrates with the existing System.Xmlreader/writer infrastructure and is easier to use than W3C DOM. There are three types that do most of the work of integrating XML with queries: XName, XElement and XAttribute.
XName provides an easy to use way to deal with the namespace-qualified identifiers (QNames) used as both element and attribute names. XName handles the efficient atomization of identifiers transparently and allows either symbols or plain strings to be used wherever a QName is needed.
XML elements and attributes are represented using XElement and XAttribute respectively. XElement and XAttribute support normal construction syntax, allowing developers to write XML expressions using a natural syntax:
XElement xml = new XElement("contacts", new XElement("contact", new XAttribute("contactId", "1"), new XElement("firstName", "Imran"), new XElement("lastName", "Chughtai") ), new XElement("contact", new XAttribute("contactId", "2"), new XElement("firstName", "Farhan"), new XElement("lastName", "Chughtai") ) ); Console.WriteLine(xml); |
|
Aspnet Discussion
- - Web application
- - Great Indian Developer Su
- - Aspx page inside Silverli
- - Open aspx page inside Sil
- - Guidance for a novice




