TinyXML-2 is a compact C++ XML library that builds a DOM from documents you can read, edit, and write back out.
Overview
TinyXML-2 parses XML into an in-memory document object model that C++ programs can traverse, modify, and serialize again. It is distributed as a single header and source file meant to drop into existing projects without pulling in the C++ standard library collections.
The library accepts UTF-8 XML, preserves whitespace according to configurable modes, reports line numbers for errors, and resolves common character entities. Applications can construct documents programmatically, stream XML from code, or load files through standard OS file APIs.
TinyXML-2 deliberately avoids DTD and XSL support to remain small and predictable. The maintainers position it for embedded or game use cases where memory allocations and footprint matter, and note that TinyXML-1 is no longer maintained.
Printing APIs can write documents to files, strings, or streams without requiring a separate serializer layer. The project also ships an example test program for quick validation.
Key features
- DOM-style XML read and write
- Single header and cpp file
- UTF-8 parsing
- Configurable whitespace handling
- Line-number error reporting
- Entity resolution for common symbols
- No C++ standard library dependency
- Stream and file output helpers
Use cases
- Embedding XML parsing in C++ applications
- Game and firmware configuration files
- Lightweight XML generation from code
- Projects needing a minimal parser dependency