1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-12-05 22:38:19 +00:00
XML parser and toolkit
Find a file
Nick Wellnhofer 22f9d73089 io: Handle clashing error codes on AIX
Regressed with 2c2578b6f. Fixes #999.
2025-10-15 15:42:12 +02:00
.gitlab-ci Remove LZMA support 2025-09-08 15:30:53 +02:00
codegen catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
doc meson: Fix install dir of man pages 2025-09-17 11:10:51 +02:00
example tests: Make global variables static 2025-08-01 15:27:11 +02:00
fuzz Remove LZMA support 2025-09-08 15:30:53 +02:00
include tree: Undeprecate several struct members 2025-10-07 12:01:05 +02:00
m4 build: Remove version script 2025-03-04 16:54:41 +01:00
python Remove LZMA support 2025-09-08 15:30:53 +02:00
result html: Escape < and > when serializing attributes 2025-08-02 15:03:18 +02:00
test catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
win32 Remove legacy win32 build system 2025-09-10 18:07:39 +02:00
xstc tests: Remove XSTC Python tests 2025-05-02 22:30:12 +02:00
.editorconfig cmake: Don't use tabs in CMakeLists.txt 2024-04-23 18:16:03 +02:00
.gitattributes Fix .gitattributes 2020-07-23 20:46:42 +02:00
.gitignore tests: Remove XSTC Python tests 2025-05-02 22:30:12 +02:00
.gitlab-ci.yml Remove LZMA support 2025-09-08 15:30:53 +02:00
autogen.sh autotools: Fix pkg.m4 check 2024-06-24 20:37:39 +02:00
buf.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
c14n.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
catalog.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
chvalid.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
CMakeLists.txt Remove LZMA support 2025-09-08 15:30:53 +02:00
config.h.cmake.in http: Remove built-in HTTP client 2025-04-20 18:21:06 +02:00
configure.ac Remove LZMA support 2025-09-08 15:30:53 +02:00
Copyright Mention contributors in Copyright 2025-01-29 13:11:38 +01:00
debugXML.c debug: Remove obsolete handling of special case 2025-06-23 22:59:31 +02:00
dict.c Revert "dict: Rework reference counting" 2025-09-08 14:59:24 +02:00
encoding.c fuzz: Make fuzzy encoding match more lenient 2025-10-13 22:58:38 +02:00
entities.c entities: Deprecate internal DTD-related functions 2025-06-03 00:13:26 +02:00
error.c parser: Split out xmlParserInputGetWindow 2025-07-31 14:23:23 +02:00
globals.c Revert "globals: Don't export DllMain on Windows" 2025-09-29 10:50:00 +02:00
hash.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
HTMLparser.c parser: Remove xmlHaltParser 2025-07-31 14:23:23 +02:00
HTMLtree.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
libxml-2.0.pc.in build: Set Cflags.private on Windows 2024-06-21 13:51:09 +02:00
libxml.h Use __has_attribute to check for __counted_by__ support 2025-02-06 10:17:09 +01:00
libxml.m4 build: Stop installing libxml.m4 2024-06-15 20:14:03 +02:00
libxml2-config.cmake.cmake.in Remove LZMA support 2025-09-08 15:30:53 +02:00
libxml2-config.cmake.in Remove LZMA support 2025-09-08 15:30:53 +02:00
libxml2.doap libxml2.doap: Remove inactive maintainer 2025-05-13 23:00:51 +02:00
lintmain.c fuzz: Remove hacks to build lint fuzzer 2025-01-17 20:06:45 +01:00
list.c include: Stop using *Ptr typedefs in public headers 2025-05-16 18:03:12 +02:00
MAINTAINERS.md Document process to remove API functions in MAINTAINERS.md 2025-10-07 12:00:51 +02:00
Makefile.am Remove LZMA support 2025-09-08 15:30:53 +02:00
meson.build Remove LZMA support 2025-09-08 15:30:53 +02:00
meson_options.txt Remove LZMA support 2025-09-08 15:30:53 +02:00
nanohttp.c doc: Move brief to top, params to bottom of doc comments 2025-05-06 19:51:38 +02:00
NEWS Release v2.15.0 2025-09-15 13:34:13 +02:00
parser.c parser: Fix attribute normalization and standalone check 2025-09-19 13:41:17 +02:00
parserInternals.c parser: Make sure to stop parser before checking max errors 2025-08-03 18:26:29 +02:00
pattern.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
README.md Remove LZMA support 2025-09-08 15:30:53 +02:00
README.zOS Large batch of typo fixes 2019-09-30 18:04:38 +02:00
relaxng.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
runsuite.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
runtest.c schematron: Complete fix for CVE-2025-49795 2025-07-04 12:46:29 +02:00
runxmlconf.c tests: Make global variables static 2025-08-01 15:27:11 +02:00
SAX2.c valid: Don't add ids when validating entity content 2025-08-23 14:59:55 +02:00
schematron.c schematron: Fix memory safety issues in xmlSchematronReportOutput 2025-07-04 14:44:54 +02:00
shell.c Fix potential buffer overflows of interactive shell 2025-07-02 13:29:19 -04:00
testapi.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
testchar.c tests: Make global variables static 2025-08-01 15:27:11 +02:00
testdict.c tests: Fix sanitizer version check on old Apple clang 2024-11-13 20:22:32 +01:00
testdso.c warning patches from Peter Breitenlohner serious DTD parsing speedups, 2005-01-25 00:22:52 +00:00
testlimits.c tests: Make global variables static 2025-08-01 15:27:11 +02:00
testModule.c doc: Remove email addresses from documentation 2025-05-01 23:23:42 +02:00
testparser.c tests: Silence testparser 2025-07-31 15:20:20 +02:00
testrecurse.c tests: Always use xmlMalloc/xmlFree 2025-05-25 22:47:34 +02:00
threads.c Revert "dict: Rework reference counting" 2025-09-08 14:59:24 +02:00
timsort.h xpath: Hide internal sort functions 2024-10-19 14:53:25 +02:00
tree.c tree: Guard against atype corruption 2025-08-05 22:59:31 +02:00
uri.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
valid.c valid: Undeprecate xmlValidGetPotentialChildren 2025-09-26 16:29:10 +02:00
VERSION Bump version to 2.16.0 2025-09-15 13:57:30 +02:00
xinclude.c doc: Stop using *Ptr typedefs in documentation 2025-05-16 18:03:12 +02:00
xlink.c doc: Stop using *Ptr typedefs in documentation 2025-05-16 18:03:12 +02:00
xml2-config-meson meson: Install a xml2-config script 2025-03-13 18:36:32 +01:00
xml2-config.in build: Fix XML_LIBDIR usage 2024-06-21 13:48:22 +02:00
xmlcatalog.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
xmlIO.c io: Handle clashing error codes on AIX 2025-10-15 15:42:12 +02:00
xmllint.c Remove LZMA support 2025-09-08 15:30:53 +02:00
xmlmemory.c doc: Small fixes 2025-06-03 00:17:03 +02:00
xmlmodule.c doc: Misc fixes 2025-06-03 01:27:12 +02:00
xmlreader.c reader: Remove unused member xinclude_name 2025-06-23 22:59:31 +02:00
xmlregexp.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
xmlsave.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
xmlschemas.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
xmlschemastypes.c xmlschemastypes: ensure thread safe global initialization 2025-06-26 17:46:01 +01:00
xmlstring.c doc: Fix autolink errors 2025-05-28 16:02:41 +02:00
xmlwriter.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
xpath.c xpath: Add extra info to some error messages 2025-06-27 18:54:18 +02:00
xpointer.c doc: Misc fixes to xpointer 2025-06-03 00:59:00 +02:00

libxml2

libxml2 is an XML toolkit implemented in C, originally developed for the GNOME Project.

Official releases can be downloaded from https://download.gnome.org/sources/libxml2/

The git repository is hosted on GNOME's GitLab server: https://gitlab.gnome.org/GNOME/libxml2

Bugs should be reported at https://gitlab.gnome.org/GNOME/libxml2/-/issues.

Documentation is available at https://gitlab.gnome.org/GNOME/libxml2/-/wikis

License

This code is released under the MIT License, see the Copyright file.

Security

This is open-source software written by hobbyists, maintained by a single volunteer, badly tested, written in a memory-unsafe language and full of security bugs. It is foolish to use this software to process untrusted data. As such, we treat security issues like any other bug. Each security report we receive will be made public immediately and won't be prioritized.

Build instructions

libxml2 can be built with GNU Autotools, CMake or meson.

Autotools (for POSIX systems like Linux, BSD, macOS)

If you build from a Git tree, you have to install Autotools and start by generating the configuration files with:

./autogen.sh [configuration options]

If you build from a source tarball, extract the archive with:

tar xf libxml2-xxx.tar.gz
cd libxml2-xxx

Then you can configure and build the library:

./configure [configuration options]
make

The following options disable or enable code modules and relevant symbols:

--with-c14n             Canonical XML 1.0 support (on)
--with-catalog          XML Catalogs support (on)
--with-debug            debugging module (on)
--with-docs             Build documentation (off)
--with-history          history support for xmllint shell (off)
--with-readline[=DIR]   use readline in DIR for shell (off)
--with-html             HTML parser (on)
--with-http             ABI compatibility for removed HTTP support (off)
--with-iconv[=DIR]      iconv support (on)
--with-icu              ICU support (off)
--with-iso8859x         ISO-8859-X support if no iconv (on)
--with-modules          dynamic modules support (on)
--with-output           serialization support (on)
--with-pattern          xmlPattern selection interface (on)
--with-push             push parser interfaces (on)
--with-python           Python bindings (off)
--with-reader           xmlReader parsing interface (on)
--with-regexps          regular expressions support (on)
--with-relaxng          RELAX NG support (on)
--with-sax1             older SAX1 interface (on)
--with-schemas          XML Schemas 1.0 support (on)
--with-schematron       Schematron support (off)
--with-threads          multithreading support (on)
--with-thread-alloc     per-thread malloc hooks (off)
--with-valid            DTD validation support (on)
--with-writer           xmlWriter serialization interface (on)
--with-xinclude         XInclude 1.0 support (on)
--with-xpath            XPath 1.0 support (on)
--with-xptr             XPointer support (on)
--with-zlib[=DIR]       use libz in DIR (off)

Other options:

--prefix=DIR            set installation prefix
--with-minimum          build a minimally sized library (off)
--with-legacy           maximum ABI compatibility (off)

Note that by default, no optimization options are used. You have to enable them manually, for example with:

CFLAGS='-O2 -fno-semantic-interposition' ./configure

Now you can run the test suite with:

make check

Please report test failures to the bug tracker.

Then you can install the library:

make install

At that point you may have to rerun ldconfig or a similar utility to update your list of installed shared libs.

CMake (mainly for Windows)

Example commands:

cmake -E tar xf libxml2-xxx.tar.xz
cmake -S libxml2-xxx -B builddir [options]
cmake --build builddir
ctest --test-dir builddir
cmake --install builddir

Common CMake options include:

-D BUILD_SHARED_LIBS=OFF            # build static libraries
-D CMAKE_BUILD_TYPE=Release         # specify build type (single-config)
--config Release                    # specify build type (multi-config)
-D CMAKE_INSTALL_PREFIX=/usr/local  # specify the install path
-D LIBXML2_WITH_ICONV=OFF           # disable iconv
-D LIBXML2_WITH_ZLIB=ON             # enable zlib

You can also open the libxml source directory with its CMakeLists.txt directly in various IDEs such as CLion, QtCreator, or Visual Studio.

Meson

Example commands:

meson setup [options] builddir
ninja -C builddir
meson test -C builddir
ninja -C builddir install

See the meson_options.txt file for options. For example:

-Dprefix=$prefix
-Dhistory=enabled
-Dschemas=disabled
-Dzlib=enabled

Dependencies

libxml2 supports POSIX and Windows operating systems.

The iconv function is required for conversion of character encodings. This function is part of POSIX.1-2001. If your platform doesn't provide iconv, you need an external libiconv library, for example GNU libiconv. Using ICU is also supported but discouraged.

The xmllint executable uses libreadline and libhistory if enabled.

Build requirements

Besides build system tools, only a C compiler should be required. Reconfiguration of the Autotools build requires the pkg.m4 macro from pkg-config. Building the documentation requires Doxygen, xsltproc and the DocBook 4 XSLT stylesheets. Building the Python bindings requires Doxygen.

Contributing

The current version of the code can be found in GNOME's GitLab at https://gitlab.gnome.org/GNOME/libxml2. The best way to get involved is by creating issues and merge requests on GitLab.

All code must conform to C89 and pass the GitLab CI tests. Add regression tests if possible.

Authors

  • Daniel Veillard
  • Bjorn Reese
  • William Brack
  • Igor Zlatkovic for the Windows port
  • Aleksey Sanin
  • Nick Wellnhofer