The raised event
will show a message similar to the one below:
// Remove an element from the ClassicIcecreams element so
that the events get fired
ClassicIcecreams.Element("Icecream").Remove();
}
XML Literals and Embedded Expressions
in Visual Basic
Visual Basic supports XML to be added to the code by XML literals. This makes it
easier to create XML elements, documents and fragments as we have the code and
XML together without any additional dependency. Visual Basic compiles the XML
Literals to LINQ to XML Objects. LINQ to XML provides a simple object model by
which we can manipulate the XML data.
LINQ to XML
[ 74 ]
The following code shows a sample of XML literals added to the Visual Basic code
which gives a LINQ to XML XElement object. We just have to type or copy the XML
directly to the code section. An XML literal does not require a line continuation
character. This helps us copy the XML into code without any changes or updates
to the XML. If we add the line continuation character to the XML, the compiler will
treat the line continuation character as part of the XML.
Pages:
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133