1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2026-09-20 00:29:41 +00:00
XML parser and toolkit
  • C 85.4%
  • HTML 6.9%
  • Python 4%
  • POV-Ray SDL 1.2%
  • CMake 0.7%
  • Other 1.6%
Find a file
Daniel Garcia Moreno 81c05bafd4 c14n: Fix xmlC14NNewCtx doc
Remove trailing backtick in xmlC14NNewCtx doc, this change should fix
the problem reported

```
c14n.c:2171: error: Reached end of file while still searching closing
'`' of a verbatim block starting at line 2062 (warning treated as
error, aborting now)
```

See e549622bc5 (note_2833189)
2026-09-04 19:40:25 +02:00
.gitlab-ci CI: Update Dockerfile base from 24.04 to 26.04 2026-06-09 13:45:16 +02:00
codegen catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
doc fix to issue 227 adding xpath0 to xmllint 2025-12-11 11:25:04 -05:00
example meson: Build examples when tests are built 2026-06-28 20:06:32 -07:00
fuzz Remove LZMA support 2025-09-08 15:30:53 +02:00
include parser: Move xmlAttrNormalizeSpace to private/parser.h 2026-06-29 05:52:48 +00:00
m4 build: Remove version script 2025-03-04 16:54:41 +01:00
python xmlregexp: Add support for non-standard escapes in character groups 2026-04-08 07:15:10 +07:00
result Handle whitespace for date/time/duration types 2026-08-07 10:06:52 +02:00
test catalog: Fix NULL deref for nextCatalog without 'catalog' attribute 2026-08-11 05:37:03 +00: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 Add /build and /install directories to gitignore 2025-12-16 07:41:35 +01:00
.gitlab-ci.yml CI: Remove external fuzzing 2026-05-25 09:49:29 +02:00
autogen.sh autotools: Fix pkg.m4 check 2024-06-24 20:37:39 +02:00
buf.c buf: Add check of return values in xmlBufferCreateStatic 2026-05-20 10:18:56 +02:00
c14n.c c14n: Fix xmlC14NNewCtx doc 2026-09-04 19:40:25 +02:00
catalog.c catalog: Fix NULL deref for nextCatalog without 'catalog' attribute 2026-08-11 05:37:03 +00:00
chvalid.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
CMakeLists.txt catalog: Fix NULL deref for nextCatalog without 'catalog' attribute 2026-08-11 05:37:03 +00:00
config.h.cmake.in http: Remove built-in HTTP client 2025-04-20 18:21:06 +02:00
configure.ac build: compile option WINPATH to allow processing Windows path on other platforms 2026-01-14 07:38:48 +00: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 fix: add overflow checks to xmlDictAddQString in dict.c 2026-04-24 05:43:17 +00:00
encoding.c fuzz: Make fuzzy encoding match more lenient 2025-10-13 22:58:38 +02:00
entities.c entities: copy children in xmlCopyEntity 2026-04-13 09:21:20 +00:00
error.c parser: Split out xmlParserInputGetWindow 2025-07-31 14:23:23 +02:00
globals.c Fix memory leak in static Windows library, for the case where libxml is used on the main thread. 2026-05-04 07:56:25 +00:00
hash.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
HTMLparser.c HTMLparser: fix build in ubuntu:26.04 with gcc 2026-06-09 13:45:16 +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 Add email to danigm maintainer entry 2025-12-10 07:32:52 +01: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 runtest: Add test for Memory leak in xmlInputFromFd 2026-03-18 10:23:01 +01:00
meson.build meson: Defer building tests until they're run 2026-06-28 20:06:32 -07:00
meson_options.txt build: compile option WINPATH to allow processing Windows path on other platforms 2026-01-14 07:38:48 +00:00
nanohttp.c Fix nanohttp.c build when --without-output 2026-03-05 18:55:25 +00:00
NEWS Release v2.15.0 2025-09-15 13:34:13 +02:00
parser.c parser: fix division-by-zero when maxAmpl is set to 0 2026-07-02 08:31:29 +00:00
parserInternals.c parser: Fix memory leak in xmlCtxtSetSaxHandler 2026-07-20 02:27:48 +02:00
pattern.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
README.md Add Strict No LLM / No AI policy 2026-05-29 09:19:59 +02:00
README.zOS Large batch of typo fixes 2019-09-30 18:04:38 +02:00
relaxng.c review: address MR !409 feedback 2026-06-01 05:44:33 +00:00
run_and_diff.cmake Add tests that relied on POSIX shell script to native CMake. 2025-12-12 11:11:11 +00:00
runsuite.c relaxng: Added xmlRelaxNGValidCtxtClearErrors to recover from errors during streaming validation 2025-08-18 10:18:41 +00:00
runtest.c Normalize entity values in attr in xmlNodeGetContent 2026-06-29 05:52:48 +00: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: use xmlGrowArray for overflow-checked array growth 2026-06-01 05:44:33 +00:00
shell.c shell: free cmdline before continue 2025-12-10 12:21:16 +00:00
test_xmlcatalog_add_del.cmake Add tests that relied on POSIX shell script to native CMake. 2025-12-12 11:11:11 +00:00
testapi.c catalog: Prepare to make SGML catalog support optional 2025-08-20 13:09:03 +02:00
testcatalog.c catalog: Fix NULL deref for nextCatalog without 'catalog' attribute 2026-08-11 05:37:03 +00: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 test: fix mismatched signed/unsigned comparison 2026-03-15 23:44:37 +00:00
testModule.c doc: Remove email addresses from documentation 2025-05-01 23:23:42 +02:00
testparser.c parser: Fix memory leak in xmlCtxtSetSaxHandler 2026-07-20 02:27:48 +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 parser: Move xmlAttrNormalizeSpace to private/parser.h 2026-06-29 05:52:48 +00:00
uri.c fix: add length check to xmlURIEscapeStr in uri.c 2026-04-24 05:43:17 +00:00
valid.c fix: add bounds checks to xmlSnprintfElements in valid.c 2026-04-24 05:43:17 +00:00
VERSION Bump version to 2.16.0 2025-09-15 13:57:30 +02:00
xinclude.c fix(xinclude): propagate parseFlags in xmlXIncludeProcess and xmlXIncludeProcessTree 2026-05-15 15:45:33 +10: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 xmlcatalog: overflow check for large --shell commands 2026-05-22 12:21:20 +02:00
xmlIO.c xmlIO: Check for int overflow before calling writecallback 2026-05-04 09:54:34 +02:00
xmllint.c xmllint: Add NULL checks for xmlStrdup/xmlStrcat in resource loader 2026-05-26 10:09:57 +00:00
xmlmemory.c xmlGrowArray: guard against NULL capacity pointer 2026-06-01 05:44:33 +00:00
xmlmodule.c doc: Misc fixes 2025-06-03 01:27:12 +02:00
xmlreader.c xmlreader: Copy DTD in xmlTextReaderDumpCopy 2026-05-12 07:19:03 +00:00
xmlregexp.c xmlregexp: Calc string length after null checking 2026-05-04 07:56:18 +02:00
xmlsave.c doc: Prefix autolinks with '#' 2025-05-28 16:01:52 +02:00
xmlschemas.c xmlschemas: Initialize some variables 2026-05-04 08:36:58 +02:00
xmlschemastypes.c Handle whitespace for date/time/duration types 2026-08-07 10:06:52 +02:00
xmlstring.c xmlstring: Free cur on every error for xmlStrncat 2026-03-16 06:53:43 +00:00
xmlwriter.c fix memory leak in issue 1054 2026-02-11 22:32:12 +00:00
xpath.c Ignore next/prev of documents when traversing XPath 2026-01-14 07:14:04 +00:00
xpointer.c xpointer: Check overflow in xmlXPtrEvalXPtrPart 2026-05-04 09:33:45 +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 and maintained by volunteers.

It's NOT recommended to use this software to process untrusted data. There is a lot of ways that a malicious crafted xml could exploit a hidden vulnerability in the software.

The software is provided "as is", without warranty of any kind, express or implied. Use this software at your own risk.

To report security bugs, you can create a confidential issue with the "security" label. We will review and work on it as a best effort. But remember that this is a community project, maintained by volunteer developers, so if you are concern about any important security bug that's critical for you, feel free to collaborate and provide a patch.

The main rule is to be kind. Do not pressure developers to fix a CVE or to work on a functionality that you need, because that won't work. This is a community project, developers will work in the issues that they consider interesting and when they want. All contributions are welcome, so if something is important for you, you can always get involved, implement it yourself and be part of the open source community.

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-winpath          Windows path support (on for Windows)
--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.

Strict No LLM / No AI Policy

No LLMs for issues.

No LLMs for patches / pull requests.

No LLMs for comments on the bug tracker, including translation.

English is encouraged, but not required. You are welcome to post in your native language and rely on others to have their own translation tools of choice to interpret your words.

Authors

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