Prev | Current Page 59 | Next

Satheesh, N Kumar

"LINQ Quickly"


??? ??? ??? ??? ??? ??? ???
LINQ to XML
[ 36 ]
XElement Class
This is one of the fundamental classes of all LINQ to XML classes. The entire XML
tree is created using this class, as we have seen in the functional construction section.
XML data manipulation and traversing through the XML tree happens using
XElement object, as seen in the following code:
new XElement("Nutrition","Calories:290",
new XAttribute("TotalFat", "18g"))
XAttribute Class
These are the name or value pair associated with an XML element, but they are not
derived from nodes. Working with attributes is similar to working with XElements.
Using functional construction, attributes are added to the elements to form the XML
tree. The XAttribute class has one constructor which takes two parameters. The first
parameter specifies the name, and the second specifies the content, as shown in the
following code:
new XElement("Nutrition","Calories:290",
new Xattribute("TotalFat", "18g"))
XDocument Class
Similar to W3C DOM, the XDocument is a container for the XML document.


Pages:
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
kominek życzenia z okazji urodzin katalog stron pozycjonowanie dieta light