1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 20:25:14 +03:00
XML parser and toolkit
Go to file
2024-05-14 16:04:56 +02:00
.gitlab-ci meson: Initial commit 2024-04-04 12:23:39 +02:00
doc doc: Remove tutorial 2024-04-28 22:57:02 +02:00
example doc: Move doc/examples to example 2024-04-28 21:55:34 +02:00
fuzz fuzz: Enable xmllint fuzzer on OSS-Fuzz 2024-05-13 13:42:43 +02:00
include threads: Deprecate remaining ThrDef functions 2024-05-14 15:44:50 +02:00
m4 Link with --undefined-version 2023-04-29 19:12:23 +02:00
os400 fix Schematron spelling 2022-05-06 10:44:03 +02:00
python threads: Deprecate remaining ThrDef functions 2024-05-14 15:44:50 +02:00
result parser: Always throw entity errors if external DTD is loaded 2024-05-03 11:52:54 +02:00
test test: Remove unused test files 2024-04-24 22:50:53 +02:00
win32 Stop defining _REENTRANT 2024-05-13 13:08:14 +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 doc: Move doc/examples to example 2024-04-28 21:55:34 +02:00
.gitlab-ci.yml doc: Remove tutorial 2024-04-28 22:57:02 +02:00
autogen.sh ci: Show config.log if configuration failed 2024-03-22 18:39:57 +01:00
buf.c io: Allocate output buffer with XML_BUFFER_ALLOC_IO 2024-03-18 15:14:43 +01:00
c14n.c c14n: Fix memory leak after malloc failure 2024-05-07 17:11:18 +02:00
catalog.c catalog: Fetch XML catalog before dumping 2024-03-03 22:29:05 +01:00
check-relaxng-test-suite2.py Stop calling xmlMemoryDump 2023-04-30 15:48:41 +02:00
check-relaxng-test-suite.py Stop calling xmlMemoryDump 2023-04-30 15:48:41 +02:00
check-xinclude-test-suite.py Use python3 not python 2022-12-07 13:21:12 +00:00
check-xml-test-suite.py Use python3 not python 2022-12-07 13:21:12 +00:00
check-xsddata-test-suite.py Stop calling xmlMemoryDump 2023-04-30 15:48:41 +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 Stop defining _REENTRANT 2024-05-13 13:08:14 +02:00
config.h.cmake.in dict: Get random seed from system PRNG 2023-12-24 16:24:34 +01:00
configure.ac Stop defining _REENTRANT 2024-05-13 13:08:14 +02:00
Copyright Remove Trio 2023-11-23 15:48:52 +01:00
dbgen.pl add a Timingtests target to check bad behaviour from the streaming engine 2003-09-17 22:33:22 +00:00
dbgenattr.pl add a Timingtests target to check bad behaviour from the streaming engine 2003-09-17 22:33:22 +00:00
debugXML.c xmllint: Make some strings const 2024-05-05 17:26:11 +02:00
dict.c dict: Include unistd.h for getentropy 2024-02-14 14:39:19 +01:00
encoding.c Make some globals const 2024-04-28 17:53:39 +02:00
entities.c Make some globals const 2024-04-28 17:53:39 +02:00
error.c error: Fix direct invocation of SAX error handlers 2024-04-09 16:54:02 +02:00
genChRanges.py libxml.h: Don't include stdio.h 2022-12-08 04:24:57 +01:00
gentest.py Revert "tree: Only allow elements in xmlDocSetRootElement" 2024-03-29 15:29:53 +01:00
genUnicode.py unicode: Deprecate most xmlUCSIs* functions 2024-04-30 17:42:59 +02:00
globals.c memory: Remove memory debugging 2024-04-28 20:42:55 +02:00
hash.c hash: Report malloc failures 2023-12-11 22:05:47 +01:00
HTMLparser.c io: Don't set close callback in xmlParserInputBufferCreateFd 2024-05-05 17:27:12 +02:00
HTMLtree.c html: Fix memory leak after malloc failure 2024-05-06 17:40:15 +02:00
legacy.c parser: Remove xmlSetEntityReferenceFunc feature 2023-12-29 01:20:51 +01: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-uninstalled.pc.in autoconf: Don't bake build time CFLAGS into pkg-config file 2023-09-04 22:14:02 +01:00
libxml-2.0.pc.in autoconf: Don't bake build time CFLAGS into pkg-config file 2023-09-04 22:14:02 +01:00
libxml.h dict: Fix warnings with older clang 2024-01-25 20:41:42 +01:00
libxml.m4 libxml.m4: Fix "possibly undefined macro" error 2023-04-30 13:18:47 +02:00
list.c misc: Improve error handling 2023-12-21 15:02:24 +01:00
MAINTAINERS.md Remove references to old mailing list 2024-04-30 17:00:01 +02:00
Makefile.am Stop defining _REENTRANT 2024-05-13 13:08:14 +02:00
meson_options.txt memory: Remove memory debugging 2024-04-28 20:42:55 +02:00
meson.build Stop defining _REENTRANT 2024-05-13 13:08:14 +02:00
nanoftp.c misc: Improve error handling 2023-12-21 15:02:24 +01:00
nanohttp.c http: Don't pass NULL pointer as memcpy source 2024-05-06 17:35:26 +02:00
NEWS build: Disable support for compression libraries by default 2024-04-02 13:25:56 +02:00
parser.c SAX2: Warn if URI resolution failed 2024-05-13 12:50:08 +02:00
parserInternals.c parser: Report malloc failure in xmlNewInputFromFile 2024-05-14 16:04:56 +02:00
pattern.c pattern: Fix memory leak xmlCompileStepPattern 2024-05-13 12:50:08 +02:00
README.md Remove references to old mailing list 2024-04-30 17:00:01 +02:00
README.zOS Large batch of typo fixes 2019-09-30 18:04:38 +02:00
relaxng.c relaxng: Fix tree corruption in xmlRelaxNGParseNameClass 2024-04-05 13:45:06 +02:00
rngparser.c relaxng: Improve error handling 2023-12-21 15:01:42 +01:00
runsuite.c Allow unlimited length decimals, integers etc. 2024-04-30 12:33:47 +02:00
runtest.c parser: Always throw entity errors if external DTD is loaded 2024-05-03 11:52:54 +02:00
runxmlconf.c memory: Remove memory debugging 2024-04-28 20:42:55 +02:00
SAX2.c SAX2: Warn if URI resolution failed 2024-05-13 12:50:08 +02:00
SAX.c globals: Stop including globals.h 2023-09-20 22:07:40 +02:00
schematron.c error: Stop printing some errors by default 2023-12-21 15:02:24 +01:00
testapi.c Revert "tree: Only allow elements in xmlDocSetRootElement" 2024-03-29 15:29:53 +01:00
testchar.c parser: Remove xmlErrEncoding 2023-12-21 15:02:24 +01: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 tests: Move away from global error handlers 2024-01-04 15:41:43 +01:00
testModule.c include: Remove more unnecessary includes 2023-09-21 01:50:53 +02:00
testparser.c tree: Handle predefined entities in xmlBufGetEntityRefContent 2024-04-30 16:05:42 +02:00
testrecurse.c tests: Move away from global error handlers 2024-01-04 15:41:43 +01:00
testThreads.c include: Remove more unnecessary includes 2023-09-21 01:50:53 +02:00
threads.c dict: Move local RNG state to global state 2023-12-24 16:24:34 +01:00
timsort.h Large batch of typo fixes 2019-09-30 18:04:38 +02:00
tree.c tree: Handle predefined entities in xmlBufGetEntityRefContent 2024-04-30 16:05:42 +02:00
uri.c uri: Keep fragment intact when resolving filesystem paths 2023-12-28 17:07:03 +01:00
valid.c valid: Report malloc failure after xmlRegExecPushString 2024-05-13 13:08:14 +02:00
xinclude.c xinclude: Report malloc failure in xmlXIncludeMergeEntities 2024-04-27 16:31:01 +02:00
xlink.c include: Remove more unnecessary includes 2023-09-21 01:50:53 +02:00
xml2-config.in build: Generate better pkg-config files for static-only builds 2023-09-03 08:52:36 +01:00
xmlcatalog.c globals: Stop including globals.h 2023-09-20 22:07:40 +02:00
xmlIO.c io: Don't set close callback in xmlParserInputBufferCreateFd 2024-05-05 17:27:12 +02:00
xmllint.c fuzz: Add xmllint fuzzer 2024-05-13 12:50:08 +02:00
xmlmemory.c memory: Remove memory debugging 2024-04-28 20:42:55 +02:00
xmlmodule.c misc: Improve error handling 2023-12-21 15:02:24 +01:00
xmlreader.c reader: Fix error reporting with walker 2024-05-13 12:50:08 +02:00
xmlregexp.c valid: Report malloc failure after xmlRegExecPushString 2024-05-13 13:08:14 +02:00
xmlsave.c parser: Always decode entities in namespace URIs 2024-04-15 12:34:26 +02:00
xmlschemas.c schemas: Fix ADD_ANNOTATION 2024-03-17 16:14:04 +01:00
xmlschemastypes.c Allow unlimited length decimals, integers etc. 2024-04-30 12:33:47 +02:00
xmlstring.c string: Don't validate UTF-8 in xmlUTF8Strsub 2024-04-02 15:34:45 +02:00
xmlunicode.c Mark more static data as const 2022-04-07 12:01:23 -07:00
xmlwriter.c save: Don't write directly to internal buffer 2024-02-16 16:14:05 +01:00
xpath.c xpath: Fix quadratic runtime accounting 2024-05-14 15:55:18 +02:00
xpointer.c xpath: Report malloc failure in xmlXPtrEvalXPtrPart 2024-01-10 16:02:33 +01:00
xzlib.c io: More refactoring and unescaping fixes 2023-12-25 23:38:40 +01: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 and shell (on)
--with-history          history support for shell (off)
--with-readline[=DIR]   use readline in DIR (for shell history)
--with-html             HTML parser (on)
--with-http             HTTP support (on)
--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-run-debug        runtime debugging module (off)
--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 -Dftp=true -Dhistory=true -Dicu=true -Dhttp=true 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