Visual Basic 2005 XML Programming Using XML DOM
(Page 1 of 6 )
This article mainly focuses on manipulating XML documents using the XML API available in the .NET Framework. In simple terms, we will design a Windows Form and do all CRUD operations against an existing XML document.
To make the article simple, I designed a Windows Form as follows.

The entire source code for this article is available in the form of a free downloadable zip file. The solution was developed using Microsoft Visual Studio 2005 on Microsoft Windows Server 2003 Standard Edition (with SP3). I didn't really test it in any other environment. I request that you post in the discussion area if you have any problems in execution.
Understanding the structure of the sample XML document
Before we start manipulating the XML document, we should fully understand the content and structure of the XML document on which we are working. Let us try to understand the structure of the sample XML document from the following figure.

The above would read something like the following:
A company has a few departments. Each department has information about its number, name, location and a few employees working in the same. Similarly, all employee information is maintained with an ID, number, name, salary and department number.
The starting point (say root) of the document is company (or "CompanyInfo"). All of the departments in the company are maintained (encapsulated) in a single unit named "DepartmentInfo." The "DepartmentInfo" contains a group of departments. Each piece of department information starts with a "Department" tag (or element). Every "Department" also has an "ID" as attribute and a group of elements directly beneath it. The tags "Deptno," "Dname," "Location" and "EmployeeInfo" are direct descendants of the "Department" tag. The "EmployeeInfo" contains a group of employees (along with their information). Every employee and his information ("Empno," "Ename," "Sal" and "Deptno") is embedded in a single parent element named "Employee," which is again a direct descendant to the "EmployeeInfo" element.
Next: Sample XML document: source >>
More Windows Scripting Articles
More By Jagadish Chaterjee