As noted in the previous lab, the debugger allows you to examine text, HMTL, and XML. In this lab you'll create an XML document, read it into a program, and then examine the XML data using the XML Visualizer.
Note: Visual Studio 2005 provides an XML Visualizer for examining XML data.
Create a new Console application named ExamineXML. Add an XML file to the project by right-clicking the project and choosing Add
Place a breakpoint on the last line of the Main method. When you hit the breakpoint, hover your mouse cursor over the complete XML string. The string will be shown, and at the end of the display will be a magnifying glass. Click the magnifying glass and you'll have the opportunity to pick the Visualizer you want to use, as shown in Figure 2-20 (the arrow in Figure 2-20 points to the magnifying glass).
Figure 2-20. Picking the Visualizer
You can examine the complete string in the debugger using either the Text Visualizer or, more interestingly, the XML Visualizer, as shown in Figure 2-21.
Figure 2-21. The XML Visualizer
Warning: The XML Visualizer will not work as shown if encoding = "utf-8" is specified in the XML file.
...custom (proprietary) data?
The framework provides you with classes to enable you to create your own visualizers. To see how, read the MSDN article "How to: Create a Debugger Visualizer Using Visual Studio 2005."
Run a search in Google with the words "Visual Studio Visualizer." When I ran that search I found more than 700 hits, many of which were projects that demonstrated how to create new visualizers, such as image visualizers. This is a rapidly emerging technology.