1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-23 17:33:50 +03:00
XML parser and toolkit
Go to file
Nick Wellnhofer c46b89e243 xpath: Deprecate xmlXPathEvalExpr
Also check the argument instead of crashing if there's no context.
2024-09-13 21:06:36 +02:00
.gitlab-ci ci: Add job for perl-XML-LibXML 2024-07-04 15:47:49 +02:00
doc doc: Document all xmllint options 2024-08-28 22:03:30 +02:00
example build: Remove --with-tree configuration option 2024-06-16 18:47:12 +02:00
fuzz tree: Restore return value of xmlNodeListGetString with NULL list 2024-08-12 21:38:50 +02:00
include xpath: Deprecate xmlXPathEvalExpr 2024-09-13 21:06:36 +02:00
m4 autotools: Use AX_GCC_FUNC_ATTRIBUTE from autoconf archives 2024-06-25 22:19:47 +02:00
os400 fix Schematron spelling 2022-05-06 10:44:03 +02:00
python xpath: Deprecate xmlXPathEvalExpr 2024-09-13 21:06:36 +02:00
result parser: Make unsupported encodings an error in declarations 2024-09-02 19:29:39 +02:00
test parser: Make unsupported encodings an error in declarations 2024-09-02 19:29:39 +02:00
tools save: Optimize xmlSerializeText 2024-07-16 17:42:10 +02:00
win32 build: Don't check for pthread.h 2024-07-22 23:03:55 +02:00
xstc .gitignore: Split up and rearrange .gitignore files 2023-04-30 16:22:27 +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 old timing tests 2024-06-22 21:59:03 +02:00
.gitlab-ci.yml ci: Add job for perl-XML-LibXML 2024-07-04 15:47:49 +02:00
autogen.sh autotools: Fix pkg.m4 check 2024-06-24 20:37:39 +02:00
buf.c buf: Limit xmlBuffer size to INT_MAX 2024-07-22 13:02:07 +02:00
c14n.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
catalog.c catalog: Set xmlCatalogInitialized after setting default catalog 2024-08-19 21:18:32 +02:00
chvalid.c libxml.h: Don't include stdio.h 2022-12-08 04:24:57 +01:00
chvalid.def Remove executable bit from non-executable files 2019-09-16 15:48:59 +02:00
CMakeLists.txt build: Check for declaration of glob() function 2024-08-19 17:57:43 +02:00
config.h.cmake.in build: Check for declaration of glob() function 2024-08-19 17:57:43 +02:00
configure.ac build: Check for declaration of glob() function 2024-08-19 17:57:43 +02:00
Copyright Remove Trio 2023-11-23 15:48:52 +01:00
debugXML.c Remove unused code 2024-07-15 16:33:38 +02:00
dict.c build: Use AC_CHECK_DECLS/check_symbol_exists for getentropy 2024-07-22 17:03:27 +02:00
encoding.c encoding: Fix table entry for "UTF16" 2024-09-13 12:08:20 +02:00
entities.c entities: Rework serialization of numeric character references 2024-07-16 17:42:10 +02:00
error.c error: Make xmlLastError const 2024-07-16 17:42:10 +02:00
globals.c globals: Clean up macros and add comments 2024-07-16 19:58:09 +02:00
hash.c hash: Suppress GCC 7.3 and MINGW maybe-uninitialized warning 2024-08-16 22:26:07 +03:00
HTMLparser.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
HTMLtree.c io: Always consume encoding handler when creating output buffers 2024-07-29 14:25:39 +02:00
iso8859x.inc encoding: Rework ISO-8859-X conversion 2024-07-01 18:05:40 +02:00
legacy.c legacy: Remove most legacy functions from public headers 2024-06-17 15:47:42 +02:00
libxml2-config.cmake.cmake.in cmake: Check whether static linking dependencies found in config files 2023-09-23 16:48:54 +01:00
libxml2-config.cmake.in Set LIBXML2_FOUND if it has been properly configured 2024-01-04 19:22:57 +00:00
libxml2.doap DOAP: Add download and issue tracker entries 2023-11-27 12:53:58 +01:00
libxml2.syms libxml2.syms: Revert removal of version information 2023-04-29 18:59:41 +02:00
libxml-2.0.pc.in build: Set Cflags.private on Windows 2024-06-21 13:51:09 +02:00
libxml.h autotools: Use AX_GCC_FUNC_ATTRIBUTE from autoconf archives 2024-06-25 22:19:47 +02:00
libxml.m4 build: Stop installing libxml.m4 2024-06-15 20:14:03 +02:00
list.c clang-tidy: move assignments out of if 2024-06-20 21:11:44 -07:00
MAINTAINERS.md build: Read version number from VERSION file 2024-07-03 20:32:23 +02:00
Makefile.am autotools: Fix EXTRA_DIST 2024-08-18 12:17:10 +02:00
meson_options.txt meson: Also disable icu and thread_alloc by default 2024-07-13 15:42:02 +02:00
meson.build build: Check for declaration of glob() function 2024-08-19 17:57:43 +02:00
nanohttp.c nanohttp: Avoid ctype(3) misuse. 2024-08-07 11:12:33 +02:00
NEWS Update NEWS 2024-07-23 01:32:43 +02:00
parser.c parser: Align push parsing of CDATA sections with pull parser 2024-08-29 01:28:49 +02:00
parserInternals.c parser: Make unsupported encodings an error in declarations 2024-09-02 19:29:39 +02:00
pattern.c malloc-fail: Fix null-deref in xmlPatPushState 2024-08-04 11:47:26 +02:00
README.md README: Fix Meson examples 2024-06-22 00:12:57 +02:00
README.zOS Large batch of typo fixes 2019-09-30 18:04:38 +02:00
relaxng.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
runsuite.c parser: Rename new input API functions 2024-07-11 01:33:29 +02:00
runtest.c tests: Add fallback for glob() 2024-08-19 18:01:24 +02:00
runxmlconf.c windows: fopen files with "wb" 2024-06-22 21:29:27 +02:00
SAX2.c SAX2: Don't merge CDATA sections 2024-08-29 01:31:19 +02:00
schematron.c schematron: Use xmlMalloc 2024-07-16 17:42:10 +02:00
shell.c shell: Only use readline on terminals 2024-07-24 12:26:39 +02:00
testapi.c parser: Rename new input API functions 2024-07-11 01:33:29 +02:00
testchar.c testchar: Don't invoke encoding handler directly 2024-07-04 15:47:20 +02:00
testdict.c dict: Fix warnings with older clang 2024-01-25 20:41:42 +01:00
testdso.c warning patches from Peter Breitenlohner serious DTD parsing speedups, 2005-01-25 00:22:52 +00:00
testlimits.c clang-tidy: don't return in void functions 2024-06-20 20:37:34 +00:00
testModule.c module: Deprecate module API 2024-07-23 19:57:32 +02:00
testparser.c parser: Rename new input API functions 2024-07-11 01:33:29 +02:00
testrecurse.c tests: Add fallback for glob() 2024-08-19 18:01:24 +02:00
threads.c threads: Fix 32-bit Windows build 2024-07-18 03:48:11 +02:00
timsort.h Large batch of typo fixes 2019-09-30 18:04:38 +02:00
tree.c tree: Restore return value of xmlNodeListGetString with NULL list 2024-08-12 21:38:50 +02:00
uri.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
valid.c tree: Restore return value of xmlNodeListGetString with NULL list 2024-08-12 21:38:50 +02:00
VERSION build: Read version number from VERSION file 2024-07-03 20:32:23 +02:00
xinclude.c xinclude: Fix fallback for text includes 2024-07-18 19:32:23 +02:00
xlink.c xlink: Deprecate xlinkGetDefault* 2024-06-12 19:55:47 +02:00
xml2-config.in build: Fix XML_LIBDIR usage 2024-06-21 13:48:22 +02:00
xmlcatalog.c xmlcatalog: Improved fix for #699 2024-08-19 21:14:04 +02:00
xmlIO.c io: don't set the executable bit when creating files 2024-08-26 23:53:29 +01:00
xmllint.c doc: Document all xmllint options 2024-08-28 22:03:30 +02:00
xmlmemory.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xmlmodule.c build: Don't check for dlfcn.h and dl.h 2024-07-22 21:39:54 +02:00
xmlreader.c tree: Restore return value of xmlNodeListGetString with NULL list 2024-08-12 21:38:50 +02:00
xmlregexp.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xmlsave.c save: Make xmlEscapeTab signed 2024-09-10 17:50:08 +02:00
xmlschemas.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xmlschemastypes.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xmlstring.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xmlunicode.c clang-tidy: move assignments out of if 2024-06-20 21:11:44 -07:00
xmlwriter.c buf: Rework xmlBuf code 2024-07-16 17:42:10 +02:00
xpath.c xpath: Deprecate xmlXPathEvalExpr 2024-09-13 21:06:36 +02:00
xpointer.c memory: Deprecate xmlGcMemSetup 2024-07-16 17:42:10 +02:00
xzlib.c build: Don't check for required headers and functions 2024-06-22 18:41: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.

Build instructions

libxml2 can be built with GNU Autotools, CMake, meson or several other build systems in platform-specific subdirectories.

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-history          history support for xmllint shell (off)
--with-readline[=DIR]   use readline in DIR for shell (off)
--with-html             HTML parser (on)
--with-http             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-lzma[=DIR]       use liblzma in DIR (off)
--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 (on)
--with-reader           xmlReader parsing interface (on)
--with-regexps          regular expressions support (on)
--with-sax1             older SAX1 interface (on)
--with-schemas          XML Schemas 1.0 and RELAX NG support (on)
--with-schematron       Schematron support (on)
--with-threads          multithreading support (on)
--with-thread-alloc     per-thread malloc hooks (off)
--with-tree             DOM like tree manipulation APIs (on)
--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:

--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)

Another option for compiling libxml is using CMake:

cmake -E tar xf libxml2-xxx.tar.gz
cmake -S libxml2-xxx -B libxml2-xxx-build [possible options]
cmake --build libxml2-xxx-build
cmake --install libxml2-xxx-build

Common CMake options include:

-D BUILD_SHARED_LIBS=OFF            # build static libraries
-D CMAKE_BUILD_TYPE=Release         # specify build type
-D CMAKE_INSTALL_PREFIX=/usr/local  # specify the install path
-D LIBXML2_WITH_ICONV=OFF           # disable iconv
-D LIBXML2_WITH_LZMA=OFF            # disable liblzma
-D LIBXML2_WITH_PYTHON=OFF          # disable Python
-D LIBXML2_WITH_ZLIB=OFF            # disable libz

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

Meson

Libxml can also be built with meson. Without option, simply call

meson setup builddir
ninja -C builddir

To add options, see the meson_options.txt file. For example:

meson setup \
    -Dprefix=$prefix \
    -Dhistory=enabled \
    -Dhttp=enabled \
    -Dschematron=disabled \
    -Dzlib=enabled \
    builddir

To install libxml:

ninja -C builddir install

To launch tests:

meson test -C builddir

Dependencies

Libxml does not require any other libraries. A platform with somewhat recent POSIX support should be sufficient (please report any violation to this rule you may find).

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. Alternatively, you can use ICU.

If enabled, libxml uses libz or liblzma to support reading compressed files. Use of this feature is discouraged.

Contributing

The current version of the code can be found in GNOME's GitLab at 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