Archive of https://github.com/zeux/pugixml — Light-weight, simple and fast XML parser for C++ with XPath support http://pugixml.org/
  • C++ 97.7%
  • CMake 1.1%
  • PowerShell 0.5%
  • Makefile 0.2%
  • Lua 0.2%
  • Other 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Arseny Kapoulkine 61421263d1
Update README
Added attribution request and moved the pugxml history as it's informational only.
2026-10-08 00:01:57 -07:00
.github Add PUGIXML_CHARCONV_FLOAT to the build matrix 2026-05-15 14:11:30 -07:00
docs Update library version to 1.16 and update docs 2026-06-15 12:18:26 -07:00
scripts scripts: Remove VS2013/2015 libraries from NuGet builds 2026-06-15 13:38:00 -07:00
src Clarify operator precedence in declaration check (#731) 2026-06-16 11:09:44 -07:00
tests Update library version to 1.16 and update docs 2026-06-15 12:18:26 -07:00
.codecov.yml Update .codecov.yml 2021-06-30 13:11:45 -07:00
.gitattributes Add .gitattributes file 2018-07-23 23:13:02 -07:00
.gitignore PUGIXML_BUILD_APPLE_FRAMEWORK now includes framework headers (#655) 2025-05-07 22:11:31 +03:00
appveyor.yml Switch AppVeyor to a sparse build matrix (#729) 2026-06-12 10:27:49 -07:00
CMakeLists.txt Update library version to 1.16 and update docs 2026-06-15 12:18:26 -07:00
LICENSE.md Update copyright year to 2026 2026-01-02 09:58:14 -08:00
Makefile Update VERSION in Makefile and add documentation for string_view_t (#641) 2024-10-28 08:06:42 -07:00
README.md Update README 2026-10-08 00:01:57 -07:00
readme.txt Update library version to 1.16 and update docs 2026-06-15 12:18:26 -07:00
SECURITY.md Create SECURITY.md 2022-02-06 09:13:33 -08:00

pugixml Actions Status Build status codecov.io MIT

pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0 implementation for complex data-driven tree queries. Full Unicode support is also available, with Unicode interface variants and conversions between different Unicode encodings (which happen automatically during parsing/saving).

pugixml is used by a lot of projects, both open-source and proprietary, for performance and easy-to-use interface.

Documentation

Documentation for the current release of pugixml is available on-line as two separate documents:

You’re advised to start with the quick-start guide; however, many important library features are either not described in it at all or only mentioned briefly; if you require more information you should read the complete manual.

Example

Here's an example of how code using pugixml looks; it opens an XML file, goes over all Tool nodes and prints tools that have a Timeout attribute greater than 0:

#include "pugixml.hpp"
#include <iostream>

int main()
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
    if (!result)
        return -1;
        
    for (pugi::xml_node tool: doc.child("Profile").child("Tools").children("Tool"))
    {
        int timeout = tool.attribute("Timeout").as_int();
        
        if (timeout > 0)
            std::cout << "Tool " << tool.attribute("Filename").value() << " has timeout " << timeout << "\n";
    }
}

And the same example using XPath:

#include "pugixml.hpp"
#include <iostream>

int main()
{
    pugi::xml_document doc;
    pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
    if (!result)
        return -1;
        
    pugi::xpath_node_set tools_with_timeout = doc.select_nodes("/Profile/Tools/Tool[@Timeout > 0]");
    
    for (pugi::xpath_node node: tools_with_timeout)
    {
        pugi::xml_node tool = node.node();
        std::cout << "Tool " << tool.attribute("Filename").value() <<
            " has timeout " << tool.attribute("Timeout").as_int() << "\n";
    }
}

License

This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).

To honor the license agreement, please include attribution into the user-facing product documentation and/or credits, for example using this or similar text:

Uses pugixml. Copyright (c) 2006-2026, Arseny Kapoulkine

This work is based on the pugxml parser, which carried the following Public Domain dedication
// Pug XML Parser - Version 1.0002
// --------------------------------------------------------
// Copyright (C) 2003, by Kristen Wegner (kristen@tima.net)
// Released into the Public Domain. Use at your own risk.
// See pugxml.xml for further information, history, etc.
// Contributions by Neville Franks (readonly@getsoft.com).