Using XML with Visual Basic
What's in this chapter?
The rationale behind XML
How to serialize objects to XML (and vice versa)
How to read and write XML
How to use LINQ to XML to read and edit XML
How to use XML literals within your code
The wrox.com code download for this chapter is found at www.wrox.com/remtitle.cgi?=isbn=9781118314456 on the Download Code tab. The code is in the chapter 8 download. The code for this chapter is a single solution with multiple projects. Each project represents a separate example.
This chapter describes how you can generate and manipulate Extensible Markup Language (XML) using Visual Basic 2012. The .NET Framework exposes many XML-specific namespaces that contain over 100 different classes. In addition, dozens of other classes support and implement XML-related technologies, such as those provided in ADO.NET, SQL Server, and BizTalk. Consequently, this chapter focuses on the general concepts and the most important classes.
The chapter is organized from older technologies and lower-level XML manipulation to the latest and greatest functionality. This is done because it is important you understand how XML is actually structured and manipulated in order for you to gain the most from it.
Visual Basic relies on the classes exposed in the following XML-related namespaces to transform, manipulate, and stream XML documents: