libxml++: libxml++ Reference Manual

libxml++ 2.42.4

libxml++ Reference Manual

# Description

libxml++ is a C++ wrapper for the libxml2 XML parser and builder library. It presents a simple C++-like API that can achieve common tasks with less code.

See also the libxml++ Tutorial and the libxml++ website. The online version of the tutorial describes libxml++-5.0.

# Features

- xmlpp::DomParser: A DOM-style parser.
- xmlpp::SaxParser: A SAX-style parser.
- xmlpp::TextReader: An XmlTextReader-style parser.
- A hierarchy of xmlpp::Node classes.

# Basic Usage

Include the libxml++ header:

#include <libxml++/libxml++.h>

(You may include individual headers, such as libxml++/document.h instead.)

If your source file is `program.cc`, you can compile it with:

g++ program.cc -o program `pkg-config --cflags --libs libxml++-2.6`

If your version of g++ is not C++11-compliant by default, add the `-std=c++11` option.

## Using Meson

If using Meson, include the following in `meson.build:`

xmlpp_dep = dependency('libxml++-2.6')
program_name = 'program'
cpp_sources = [ 'program.cc' ]
executable(program_name,
cpp_sources,
dependencies: xmlpp_dep
)

Your `dependencies:` keyword argument should also mention any other libraries that you need to use.

## Using Autotools

Alternatively, if using autoconf, use the following in `configure.ac:`

PKG_CHECK_MODULES([LIBXMLXX], [libxml++-2.6])

Then use the generated `LIBXMLXX_CFLAGS` and `LIBXMLXX_LIBS` variables in the project `Makefile.am` files. For example:

program_CPPFLAGS = $(LIBXMLXX_CFLAGS)
program_LDADD = $(LIBXMLXX_LIBS)

Your `PKG_CHECK_MODULES()` call should also mention any other libraries that you need to use via pkg-config.