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

Scott Klein

"Professional LINQ"

This functionality is called functional construction, which will be discussed in Chapter 6,
??????Programming with LINQ to XML.??™??™
Traversing XML
So, you have your XML document in memory, whether you created it manually or loaded it using the
Load method of the XElement class. Now what do you do with it? Specifically, how do you navigate
the XML tree to get to the node/element you want to work with?
Traversing XML in an XML tree in LINQ to XML is quite simple. Just use the methods of the XElement
and XAttribute classes as necessary. Basically, the Elements and Element methods provide all of the
element children of an XContainer (an XElement or XDocument) object. Using the XName object, such as
Element(XName), you can return the elements of that specific XName.
Once you have your XML tree loaded as shown here:
employees = XElement.Load(@"C:\Wrox\Employees.xml");
you can start ??????walking the XML tree.??™??™ Here are a couple of examples:
employees.Element("Employees").Element("Employee")
employees.Element("Employees").Element("Employee").


Pages:
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6