Part II: LINQ to XML
Overview of XML Literals
An XML Literal is a piece of XML, such as a complete XML document or XML fragment, that is
typed directly into the source code of a Visual Basic .NET module without the use of quotation
marks. Using XML literals lets you write XML directly within your Visual Basic code providing the
same structure and layout as the resulting XML. This means that you can create XML documents
and fragments easily and efficiently right in your code.
XML literal syntax is a representation of the LINQ to XML objects, with Visual Basic compiling the literals
into LINQ to XML objects. This functionality is provided via the LINQ to XML object model, which lets
you create and work with XML easily.
To get a feel for XML Literals, create a new Windows Forms Visual Basic project in Visual Studio.
When the project is created, add a reference to the System.Xml.Linq namespace. Open the form in
design view and add a few buttons and a text box. Set the Multiline property of the text box to True
and size the text box so that you can easily view an XML document or fragment.
Pages:
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306