Recursive XML Parser in C | CodeGuru

Recursive XML Parser in C

Click here for larger image Environment: Windows compiler for the GUI, ANSI C for the XML Parser. The idea of this project was simply to write a basic XML parser in ANSI C for portability. The parser is reasonably forgiving as I have only a fairly rudimentary knowledge about XML and wanted to keep the […]

Written By
CodeGuru Staff
CodeGuru Staff
Feb 20, 2002
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More





Click here for larger image

Environment: Windows compiler for the GUI, ANSI C for the XML Parser.

The idea of this project was simply to write a basic XML parser in ANSI C for
portability. The parser is reasonably forgiving as I have only a fairly rudimentary knowledge about XML and wanted to keep the code reasonably straight forward.

I then decided as an example application I’d write a simple GUI for demonstrative purposes, I decided against heavyweight MFC classes and wrote the GUI in C rather than C++ for reasons of consistency and the fact that the static nature of traditional windows programming does not lend it easily to object orientation. The GUI saves options to an XML file at termination (Options.xml) and allows you to drag and drop files onto the GUI for parsing. It consists of a rich edit window and a tree view.

When XML has been entered into the edit box and Parse selected from the menu the tree view will be updated. After the tree view has been updated you can select items in the tree view and it should also select the appropriate text in the edit window.

Note: Currently you need to reparse when you have updated the edit window before you can rely on the tree control being updated, I haven’t yet had a chance to automatically update the tree control when updates occur.

There are one are two bugs which need ironing out (nobodys perfect!), if enough people spot them I’ll have a look at them.

Downloads

Download demo project – 22.2 Kb

Download source – 29.2 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.