XMLParser library

2.1

Introduction

This is a basic XML parser written in ANSI C++ for portability. It works by using recursion and a node tree for breaking down the elements of an XML document.

Version:
V2.41
Author:
Frank Vanden Berghen

The following license terms for the "XMLParser library from Business-Insight" apply to projects that are in some way related to the "mcpat project", including applications using "mcpat project" and tools developed for enhancing "mcpat project". All other projects (not related to "mcpat project") have to use the "XMLParser library from Business-Insight" code under the Aladdin Free Public License (AFPL) See the file "AFPL-license.txt" for more informations about the AFPL license. (see http://www.artifex.com/downloads/doc/Public.htm for detailed AFPL terms)

Redistribution and use of the "XMLParser library from Business-Insight" in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Frank Vanden Berghen nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY Business-Insight ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Business-Insight BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copyright (c) 2002, Business-Insight Business-Insight All rights reserved.

First Tutorial

You can follow a simple Tutorial to know the basics...

General usage: How to include the XMLParser library inside your project.

The library is composed of two files: xmlParser.cpp and xmlParser.h. These are the ONLY 2 files that you need when using the library inside your own projects.

All the functions of the library are documented inside the comments of the file xmlParser.h. These comments can be transformed in full-fledged HTML documentation using the DOXYGEN software: simply type: "doxygen doxy.cfg"

By default, the XMLParser library uses (char*) for string representation.To use the (wchar_t*) version of the library, you need to define the "_UNICODE" preprocessor definition variable (this is usually done inside your project definition file) (This is done automatically for you when using Visual Studio).

Advanced Tutorial and Many Examples of usage.

Some very small introductory examples are described inside the Tutorial file xmlParser.html

Some additional small examples are also inside the file xmlTest.cpp (for the "char*" version of the library) and inside the file xmlTestUnicode.cpp (for the "wchar_t*" version of the library). If you have a question, please review these additionnal examples before sending an e-mail to the author.

To build the examples:

In order to build the examples you need some additional files:

Debugging with the XMLParser library

Debugging under WINDOWS

Inside Visual C++, the "debug versions" of the memory allocation functions are very slow: Do not forget to compile in "release mode" to get maximum speed. When I had to debug a software that was using the XMLParser Library, it was usually a nightmare because the library was sooOOOoooo slow in debug mode (because of the slow memory allocations in Debug mode). To solve this problem, during all the debugging session, I am now using a very fast DLL version of the XMLParser Library (the DLL is compiled in release mode). Using the DLL version of the XMLParser Library allows me to have lightening XML parsing speed even in debug! Other than that, the DLL version is useless: In the release version of my tool, I always use the normal, ".cpp"-based, XMLParser Library (I simply include the xmlParser.cpp and xmlParser.h files into the project).

The file XMLNodeAutoexp.txt contains some "tweaks" that improve substancially the display of the content of the XMLNode objects inside the Visual Studio Debugger. Believe me, once you have seen inside the debugger the "smooth" display of the XMLNode objects, you cannot live without it anymore!

Debugging under LINUX/UNIX

The speed of the debug version of the XMLParser library is tolerable so no extra work.has been done.