No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ian Johnson d73304c3d5
Some checks failed
CI / test (0.15.2) (push) Has been cancelled
CI / test (0.16.0) (push) Has been cancelled
CI / test (master) (push) Has been cancelled
CI / build-docs (push) Has been cancelled
CI / publish-docs (push) Has been cancelled
docs: add a bit more writer documentation
2026-07-21 21:43:25 -04:00
.github/workflows ci: add 0.16 to build matrix (#67) 2026-06-20 13:13:23 -04:00
bench feat: add support for Zig 0.16 (#61) 2026-06-20 14:12:05 -04:00
examples docs: add example using writer 2026-07-21 21:43:25 -04:00
fuzz test(fuzz): handle comments 2026-07-21 21:43:25 -04:00
src docs: add a bit more writer documentation 2026-07-21 21:43:25 -04:00
xmlconf test(xmlconf): clarify skip reason for 'error' tests 2026-07-21 21:43:25 -04:00
.editorconfig refactor: rewrite the project (#36) 2024-09-14 23:46:51 -04:00
.gitignore feat: add support for Zig 0.16 (#61) 2026-06-20 14:12:05 -04:00
build.zig docs: add example using writer 2026-07-21 21:43:25 -04:00
build.zig.zon feat: add support for Zig 0.16 (#61) 2026-06-20 14:12:05 -04:00
LICENSE chore: relicense to 0BSD 2023-11-23 16:52:40 -05:00
README.md docs: API documentation improvements 2026-07-21 21:43:25 -04:00

zig-xml

zig-xml is an XML library for Zig, currently supporting Zig 0.15.0 and the latest master at the time of writing.

See the documentation in the code for more information about the available APIs (start in xml.zig). Autodocs are also published to GitHub Pages: http://ianjohnson.dev/zig-xml/

The library aims to confirm with the following standards:

Currently, DTDs (DOCTYPE) are not supported.

Other standards (such as XML 1.1 or XML 1.0 prior to the fifth edition) are only supported insofar as they are compatible with the above standards. Additionally, only UTF-8 and UTF-16 encodings (as required by the standard) are supported (UTF-16 is only supported by the streaming reader).

Examples

A basic example of usage can be found in the examples directory, and can be built using zig build install-examples.

Tests

The library has several tests of its own, which can be run using zig build test.

The xmlconf directory additionally contains a runner for the W3C XML Conformance Test Suite. Running zig build test in that directory will fetch the test suite distribution tarball and run the tests within. Due to features missing in the current parser implementation (DTD support), many tests are currently skipped.

Fuzzing

There is a fuzzing sub-project in the fuzz directory using https://github.com/kristoff-it/zig-afl-kit.

Recommended fuzzing command:

afl-fuzz -x dictionaries/xml.dict -x dictionaries/xml_UTF_16.dict -x dictionaries/xml_UTF_16BE.dict -x dictionaries/xml_UTF_16LE.dict -i inputs -o outputs zig-out/bin/fuzz-xml

License

zig-xml is free software, released under the Zero Clause BSD License, as found in the LICENSE file of this repository. This license places no restrictions on your use, modification, or redistribution of the library: providing attribution is appreciated, but not required.