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

Scott Klein

"Professional LINQ"

Text = xdoc.ToString();
foreach(XNode c in xdoc.Nodes())
listBox1.Items.Add(c);
To get all the elements of a specific name, you can use the following:
foreach(XElement c in xdoc.Elements("Rider"))
listBox1.Items.Add(c);
If you know that there is only a single element with a specific name, you can use the following:
listBox1.Items.Add(xdoc.Element(XName));
The thing to remember is that the Nodes(), Elements(), Element(Name), and Elements(Name) methods
provide the foundation and basic functionality of XML tree navigation.
Manipulating XML
The great thing about LINQ to XML is the capability to easily make changes to the XML tree, such as
adding, deleting, updating, and copying content within the XML document.
Changes to an XML tree are available via the many methods of the XNode class, which represents nodes
such as elements and comments in an XML tree. More often than not, you??™ll be working at the node level,
manipulating elements and their contents or their attributes.
The next few sections discuss how to use many of the methods of the XNode class.


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