The expressions value can be a simple text, or it can be a query. The query can be
used to build the XML and the result can be an XML literal. The following code
shows a sample of an XML literal which uses the query in expressions to build XML
by fetching details from the Icecreams XML.
Dim Icecreams1 As XElement = _
<%= From c In Icecreams.Elements("Icecream") _
Select New XElement("Icecream", _
c.Element("Name").Value.ToUpper()) %>
Summary
In this chapter, we saw information and examples on programming with LINQ to
XML. We have seen the advantages of Functional Construction in constructing the
XML tree and navigating through the XML tree. We also manipulated the XML data
in the XML tree using XElement and XAttribute object properties. We saw some
examples for querying the XML using LINQ provided query operators. We also
learned importing and exporting data from different data sources like dictionaries,
databases objects, and CSV files. Lastly we saw different events that can be fired
when modifying the XML tree.
Pages:
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135