Skip to content

ianprime0509/zig-xml

Repository files navigation

zig-xml

zig-xml is an XML library for Zig, currently supporting Zig 0.13.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, nor is any non-UTF-8 encoding.

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.

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. At the time of writing, 250 tests pass, and 924 are skipped due to unsupported features.

Fuzzing

There is a fuzzing sub-project in the fuzz directory using https://github.com/kristoff-it/zig-afl-kit. If running on Zig 0.13.0, an extra step needs to be taken to make the fuzzing more effective: https://github.com/kristoff-it/zig-afl-kit/blob/main/README.md#-------important------- On Zig master, this is not needed.

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.