Visual Basic User's Guide
This chapter looks at some of the differences between normal text editing and editing an XML file.
The source code for this example is contained in the Samples\vb6\XMLEditing sample source directory.
Run the sample program and load the demo file address_list.xml. You will notice that there is now a button bar with 3 combo boxes:
You don't need to create the combo boxes yourself, they are built into Text Control's Button Bar.
The first combo box displays the style of current XML field. If you move down the caret by pressing the down arrow key, the display will change from name to street, city and email, depending on what type of field you are in.
With the second combo box, additional XML fields can be inserted.
You can select to either insert a complete address record, or one of the optional elements, which are street and city. Depending on the DTD, not all elements can be inserted at all positions. For instance, if you click on the name Paul in the first line of the document, and try to insert a street, an error will occur, because this record already contains a street. Try again with Ringo, and it will work.
The third combo box is for deleting XML fields. Again, every action is checked with the DTD, so that you can be sure not to invalidate your document by, for instance, deleting a required field.