DCMTK: XMLParser library

DCMTK Version 3.6.9 OFFIS DICOM Toolkit

Loading...
Searching...
No Matches
XMLParser library

# 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.

Copyright (c) 2002, Frank Vanden Berghen All rights reserved.

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

Redistribution and use 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 Frank Vanden Berghen `‘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 <copyright holder> 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.

Version
  V2.44

Author
  Frank Vanden Berghen

# 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 "WIDE_CHAR_XML_PARSER" preprocessor definition variable (this is usually done inside your project definition file)

# 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 additional examples before sending an e-mail to the author.

To build the examples:

- linux/unix: type "make"
- solaris: type "make -f makefile.solaris"
- windows: Visual Studio: double-click on xmlParser.dsw (under Visual Studio .NET, the .dsp and .dsw files will be automatically converted to .vcproj and .sln files)

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

- linux/unix: makefile
- solaris: makefile.solaris
- windows: Visual Studio: *.dsp, xmlParser.dsw and also xmlParser.lib and xmlParser.dll

# 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 lightning 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.

Generated on Sat Mar 1 2025 for DCMTK Version 3.6.9 by Doxygen 1.13.2