If you have ever used, and disliked, the DOM, you will love LINQ to XML. The great thing about LINQ
to XML is that it provides a small-footprint, in-memory version of the XML document that you are
querying. LINQ to XML utilizes the XML features of the System.Xml namespace, specifically the reader
and writer functionality exposed by the System.Xml namespace.
LINQ to XML exposes two classes that help LINQ integrate with XML: XElement and XAttribute. The
XElement class represents an XML element and is used in LINQ to XML to create XML element nodes or
even to filter out the data you really care about. XElement ties itself to the standard query operators by
enabling you to write queries against non-XML sources and even persist that data to other sources.
The XAttribute class is a name/value pair associated with an XML element. Each XElement contains a
list of attributes for that element, and the XAttribute class represents an XML attribute. Within LINQ,
both the XElement and XAttribute types support standard syntax construction, meaning that developers
can construct XML and XML expressions using the syntax that they already know.
Pages:
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51