XML Tree Viewer (VB)

Description: The XMLTree Viewer application is a Visual Basic application that reads an XML file and displays the contents in a TreeView control.

More Details

The project does not use any classes or sophisticated design. It simply prompts the user for an XML file to parse and display. The goal of this application is to demonstrate how to work with the XML DOM and to get an understanding of the hierarchy of an XML document.

Once a file is referenced the application uses an XML DOM reference, declared using the WithEvents keyword, to trap the ondataavailable and onreadystatechange events. The ondataavailable event is used to display a count of the nodes. The onreadystatechange event is used to check for errors and to call the DisplayDomNode routine. The DisplayDomNode routine does all the real work and loads the XML data into the TreeView.

Browser/Platform Compatibility

This sample requires Internet Explorer 5.0 and Windows 98, Windows NT 4.0, or Windows 2000.


Simply run the application click on the ellipses to locate any XML file. Then click the Load button. The XML file should be displayed in the TreeView control.

Complete Article

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.