Writing XML Markup in VB with XML Literals
The System.Xml.Linq
namespace is powerful. Manipulating complex XML documents that store a lot of data can lead to writing less elegant and more complex code. Luckily, the Visual Basic language provides a powerful feature for manipulating XML documents, known as XML literals. You can write XML markup together with the Visual Basic code. The following code provides an example:
'The compiler infers XDocumentDim Contacts = <?xml version="1.0"?> <Contacts> <Contact LastName="Del Sole" FirstName="Alessandro" Age="37" email="alessandro.delsole@visual-basic.it"/> <!-- Fantasy name--> ...
Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.