Program with DOM in Visual Basic


This tutorial is intended for Visual Basic programmers interested in writing XML applications using the DOM APIs as implemented in Microsoft XML Core Services (MSXML). It includes a series of simple examples written in Microsoft Visual Basic and tested using Microsoft Visual Basic 6.0. The objective is to provide a quick and practical orientation, so that you can start to write your own XML applications.

Each demonstration is a self-contained application that you can build and run independently. Each demonstration provides complete source code, the expected output, any required resource files, and instructions for building and running the sample application.

These demonstrations are task-oriented, and are simplified for clarity. Therefore, their implementation is not always optimized and might not represent the best coding practice.

This tutorial consists of the following demonstrations.

How Do I?Description
Set Up My Visual Basic ProjectDiscusses the requirements for using MSXML, and describes how to install the MSXML components.
Instantiate an XML DOM Object (Visual Basic)Demonstrates two ways to instantiate an XML DOM object in Visual Basic.
Load an XML File into a DOM Object (Visual Basic)Demonstrates how to create an XML DOM instance and load its content from an external XML data file.
Serialize an XML DOM Object to a File (Visual Basic)Demonstrates how to serialize an XML DOM object in a text file.
Perform XSL Transformations (Visual Basic)Demonstrates how to perform XSL Transformations (XSLT).
Create an XML DOM Object Dynamically (Visual Basic)Demonstrates how to create an XML DOM object programmatically, including processing instructions, comments, elements, attributes, CDATA sections and text nodes.
Query XML DOM Nodes (Visual Basic)Demonstrates how to query a DOM node or node-set using XPath expressions.
Make XML Requests Over HTTP (Visual Basic)Demonstrates how to perform client requests of XML data from a web server.
Validate XML (Visual Basic)Demonstrates how to validate XML documents against an XML schema as well as how to validate document node fragments.
Use the onReadyStateChange Property (Visual Basic)Demonstrates how to implement the onreadystatechange property, which was intended primarily for use by scripting clients, in Visual Basic.