SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 257 | Next

Scott Klein

"Professional LINQ"

Functional construction takes a completely different approach when
modifying and manipulating XML. In today??™s XML technology, manipulating and modifying XML usually
means a significant and detailed modification of the XML data source. LINQ to XML treats XML
154
Chapter 8: Advanced LINQ to XML Programming Topics
modification as simply a transformation problem: you can take an XML data source and efficiently transform
it to another form.
The following example uses the employee XML tree from the previous example and constructs a new
XML tree, creating two new elements and selecting the name element from the employee tree:
XElement newXML = new XElement("Info",
new XElement("CurrentDate", DateTime.Today),
new XElement("Supervisor", "Jim"),
from el in employee.Element("Employee").Elements("Name")
where (string)el == "Scott"
select el);
When you run this code, the following XML tree is constructed:

2007-06-02T00:00:00-04:00
Jim
Scott

What makes functional construction great is that you can easily control the resulting XML tree through
the query expression.


Pages:
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6