??‘ LINQ to XML supports annotations.
120
Chapter 5: Understanding LINQ to XML
??‘ LINQ to XML provides better support for whitespace. LINQ to XML stores whitespace as XText
versus having a special Whitespace node in the DOM. Additionally, in LINQ to XML you can
specify xml:space="preserve" to always preserve the whitespace.
??‘ XML programming is simplified in LINQ to XML by removing support for entities and entity
references because the management of entities is fairly complex, and truth be told, rarely used.
The benefit of this is increased performance.
LINQ to XML versus XmlReader
If you have worked with XML before, you have probably used the XmlReader class. The XmlReader
class is a fast way of dealing with XML. It is a forward-only, noncached XML parser. Unlike the previous
comparison (LINQ to XML versus the DOM), in which LINQ to XML is a replacement for the
DOM, LINQ to XML is actually tightly integrated with the XmlReader. While you can still use the
XmlReader by itself, you can utilize LINQ to XML to take advantage of the XmlReader, overlapping
much of the functionality.
Pages:
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220