Add XML config file parsing to a C++ game engine by dropping in two files with no additional build system setup.
Parse save game data or settings stored in XML format inside a resource-constrained embedded application.
Build an XML document from scratch in C++ code and write it to a file or an in-memory string buffer.
Stream XML output directly without constructing an in-memory document tree when exporting large datasets.
No external dependencies, just drop XMLDocument.h and tinyxml2.cpp into your project, works without STL containers, exceptions, or RTTI.
TinyXML-2 is a small C++ library for reading and writing XML files. XML is a text format used to store structured data, with tags and attributes much like HTML. TinyXML-2 reads an XML file and builds it into a tree of objects in memory, which your C++ code can then navigate, modify, and write back out. The entire library is just one header file and one source file, so adding it to a project is as simple as dropping in those two files. It does not require any standard library containers, exception handling, or runtime type information, which makes it particularly suitable for environments with limited resources, such as game engines or embedded systems. The README notes that TinyXML-2 was specifically rewritten from its predecessor to use less memory and fewer memory allocations compared to TinyXML-1. When TinyXML-2 parses a document, it creates an XMLDocument object that owns all the elements, text nodes, attributes, and comments inside it. You access parts of the tree by traversing from the root down through child elements. You can also build an XML document from scratch in code and write it to a file or a memory buffer, or stream XML output directly without constructing a document at all. The library handles UTF-8 text, recognizes standard XML character entities such as ampersand and less-than signs, and supports numeric character references for Unicode code points. It offers three whitespace handling modes: preserve (the default, which keeps spacing inside text but not between elements), collapse (which strips leading and trailing spaces), and pedantic (which records all whitespace including between elements). Error messages include the line number where a parse problem occurred. TinyXML-2 does not support DTD validation or XSLT stylesheets. It is released under the ZLib license, which allows use in both open source and commercial projects.
← leethomason on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.