At the least, it will be converted to a call to the XElement constructor, and if your XML literal
contains attributes, then there will be calls to the XAttribute constructor as well. If your XML literal
contains version instructions, it will be translated into a call to the XProcessingInstruction constructor.
Each class, such as the XElement and XAttribute, has an overloaded New constructor. These constructors
are called for each type found, meaning that the XML literal will be translated into a call and passed
to the corresponding constructor. For example, if you have an element that contains two attributes, the
XElement constructor will be called once and the XAttribute constructor will be called twice.
Now that you understand how XML literals work, let??™s look at some examples of creating XML.
The following example is taken from the first example in this chapter and illustrates the simple way
to create XML. It uses the XElement class to create a simple XML fragment containing employee
information.
You should be quite familiar with the XElement class by now.
Pages:
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309