Click here to Skip to main content
15,895,084 members
Articles / Web Development / HTML

XML Parser Demo

Rate me:
Please Sign up or sign in to vote.
4.71/5 (21 votes)
29 Oct 2000CPOL 334.4K   5.1K   46   50
Using the Microsoft XML (MSXML) parser.

Introduction

In an attempt to learn how to exploit XML (eXtensible Mark-up Language) within my applications, I have found a very few demonstration applications to assist me in getting started. The documentation and examples in the Platform SDK for using the Microsoft XML Parser (built into Internet Explorer 4+, although I'm using IE5) all seem to be for Visual Basic/VBScript and not for C++/MFC.

In this sample application I've simply tried to parse a XML file and visualise it as a basic tree view. The code recursively walks through both then ELEMENTS and ATTRIBUTES of the document. Some of the known element types are given an identifying icon and some of the contents/values are expressed too.

Included within the .Zip file is my first XML file including a DTD (Document Type Definition).

XML Parser
Figure 1 - Sample XML Parser Dialog

Parsing errors detected by the MSXML object are displayed within a message box and locate the problem location within the XML document.

 

Parser Error
Figure 2 - Parser Error Report

See the source code for the parser code - it's quite simple.

If you're interested, the long term aim of this file is to provide an externally configurable definition for toolbar and menu layouts within my applications. Due to the nature of the customer, end-user customisation is not applicable yet the specifications for what is wanted is likely to come through after I've left the project.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Product Manager
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralThanks a lot Pin
Roberto Tortini12-Oct-01 6:18
Roberto Tortini12-Oct-01 6:18 
GeneralNice work Pin
Amit Dey29-Apr-01 13:30
Amit Dey29-Apr-01 13:30 
GeneralRe: Nice work Pin
Ray Hayes29-Apr-01 22:41
Ray Hayes29-Apr-01 22:41 
GeneralRe: Nice work Pin
Amit Dey15-Oct-03 5:45
Amit Dey15-Oct-03 5:45 
GeneralRe: Nice work Pin
Todd.Harvey17-Apr-02 9:39
Todd.Harvey17-Apr-02 9:39 
GeneralCompile error Pin
23-Apr-01 5:56
suss23-Apr-01 5:56 
GeneralRe: Compile error Pin
Ray Hayes23-Apr-01 7:19
Ray Hayes23-Apr-01 7:19 
Generallooking for the XML tutorial FOR Beginners Pin
6-Nov-00 22:40
suss6-Nov-00 22:40 
i am looking for the xml tutorial for beginners like me..
can anyone help me out ?
mil c grg
GeneralRe: looking for the XML tutorial FOR Beginners Pin
Felix Rivera9-Nov-00 11:49
Felix Rivera9-Nov-00 11:49 
GeneralRe: looking for the XML tutorial FOR Beginners Pin
9-Nov-00 17:11
suss9-Nov-00 17:11 
GeneralMSXML 3.0 Final Pin
Brad Bruce4-Nov-00 4:06
Brad Bruce4-Nov-00 4:06 
GeneralWorth the effort Pin
Adrian31-Oct-00 19:17
Adrian31-Oct-00 19:17 
GeneralUse XML4C from Apache/IBM Pin
Jamie Nordmeyer31-Oct-00 6:27
Jamie Nordmeyer31-Oct-00 6:27 
GeneralRe: Use XML4C from Apache/IBM Pin
Joshua Nussbaum1-Nov-00 12:02
Joshua Nussbaum1-Nov-00 12:02 
GeneralRe: Use XML4C from Apache/IBM Pin
Jamie Nordmeyer1-Nov-00 12:43
Jamie Nordmeyer1-Nov-00 12:43 
GeneralRe: Use XML4C from Apache/IBM Pin
Leo Davidson3-Nov-00 1:13
Leo Davidson3-Nov-00 1:13 
GeneralRe: Use XML4C from Apache/IBM Pin
20-Aug-01 7:53
suss20-Aug-01 7:53 
GeneralXML Version 3 beta (September) Pin
Ray Hayes31-Oct-00 1:36
Ray Hayes31-Oct-00 1:36 
GeneralIt is not Working Properly Pin
VenkataKrishnan.K31-Oct-00 0:30
sussVenkataKrishnan.K31-Oct-00 0:30 
GeneralRe: It is not Working Properly Pin
Ray Hayes31-Oct-00 0:49
Ray Hayes31-Oct-00 0:49 
GeneralRe: It is not Working Properly Pin
Brad Bruce31-Oct-00 1:42
Brad Bruce31-Oct-00 1:42 
GeneralCompile Error Pin
niv30-Oct-00 23:23
niv30-Oct-00 23:23 
GeneralRe: Compile Error Pin
Ray Hayes30-Oct-00 23:46
Ray Hayes30-Oct-00 23:46 
GeneralRe: Compile Error: Include the Following Lines Pin
VenkataKrishnan.K31-Oct-00 0:48
sussVenkataKrishnan.K31-Oct-00 0:48 
GeneralRe: Compile Error: Include the Following Lines Pin
EZ31-Oct-00 9:50
EZ31-Oct-00 9:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.