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 261 | Next

Scott Klein

"Professional LINQ"

Text = newXML.ToString();
156
Chapter 8: Advanced LINQ to XML Programming Topics
The code produces the following XML tree:


Scott

555 Main St.

Wellington
FL

All Things Techy
02/05/2007
M

1
0001

By modifying the code, you can return more granular information. The highlighted line in the following
code illustrates how to return only the Address information from the loaded XML file:
XElement newXML = new XElement("Root",
emp.Element("Employee").Element("Address"),
from att in emp.Element("Employee").Attributes()
select new XElement(att.Name, (string)att));
The code produces the following XML tree:


555 Main St.

Wellington
FL

1
0001

One last example for this section: The following highlighted code uses functional construction to return
the Name element and the id attribute from the source tree to create a simple new XML tree:
XElement newXML = new XElement("Root",
emp.


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