libexpat/libexpat logo

libexpat/libexpat

Free

:herb: Fast streaming XML parser written in C99 with >90% test coverage; moved from SourceForge to GitHub

FreeFree tier
Type
Open Source

About libexpat/libexpat

Expat is a C99 library for parsing XML 1.0, started by James Clark in 1997. It is a stream-oriented XML parser where users register handlers that are called when the parser discovers structures like start tags. Expat supports GNU GCC (≥4.5 for C, ≥4.8.1 for C++), LLVM Clang (≥3.5), and Microsoft Visual Studio (≥17.0/2022). It is free software under the MIT/X Consortium license. The library has 90% test coverage and is available on GitHub. Integration with CMake is documented via find_package (module or config mode) and the FetchContent module.

Key Features

Stream-oriented XML parsing with user-registered handlers
Written in C99 for portability and performance
90% test code coverage
Supports GNU GCC, LLVM Clang, and Microsoft Visual Studio compilers
MIT/X Consortium license (free and open source)
CMake integration via find_package and FetchContent
Long-standing project since 1997
Cross-platform (Windows, Linux, macOS)

Pros & Cons

Pros
  • Fast streaming parser with minimal overhead
  • High test coverage (90%) ensures reliability
  • Mature and stable project with decades of use
  • Cross-platform support across major operating systems and compilers
  • Free and open source under MIT license
  • Well-documented integration with CMake build systems
Cons
  • Only supports XML 1.0 (not XML 1.1 or later)
  • Streaming model may be less convenient for simple DOM-like tasks
  • Project is understaffed and without funding (as noted in repository)
  • No built-in support for XPath, XSLT, or XML Schema

Best For

Parsing XML documents in C/C++ applicationsBuilding XML-based data processing toolsEmbedding XML parsing in software projectsConfiguration file parsing (XML configs)

FAQ

What is Expat?
Expat is a C99 library for parsing XML 1.0, started by James Clark in 1997. It is a stream-oriented XML parser where users register handlers that are called when the parser discovers structures like start tags.
What license does Expat use?
Expat is free software distributed under the MIT/X Consortium license.
What compilers are supported?
Expat supports GNU GCC ≥4.5 (for C) or ≥4.8.1 (for C++), LLVM Clang ≥3.5, and Microsoft Visual Studio ≥17.0/2022.
How can I use Expat with CMake?
Three documented approaches are available: find_package with Module Mode, find_package with Config Mode, and the FetchContent module. Refer to the README for detailed examples.
Is Expat still maintained?
The project is understaffed and without funding, but it remains maintained with releases. A call for help is noted in the Changes file.