Go to file
Arseny Kapoulkine 0bd2848f33 Use cleaner references to STL classes
The explicit specification of default template arguments is repetitive
and dates back to the versions of pugixml that tried to forward-declare
all STL classes manually, which ran into issues with default arguments
in some STL versions.

We've since abandoned this idea and use <string>/<iosfwd> includes, as
such it should be fine to rely on default arguments.

Note: while we could use std::wstring, this had compatibility issues
with some very early versions of Android SDK. Out of abundance of
caution, we keep basic_i/ostream and basic_string in tact. We could use
std::string but we might need to replace these in char8 mode if that
ever gets merged.
2023-11-16 10:51:20 -08:00
.github CI: decrease fuzzing time from 300s to 30s 2022-11-20 14:42:49 -08:00
docs Update version to 1.14 everywhere 2023-09-07 11:55:13 -07:00
scripts Update version to 1.14 everywhere 2023-09-07 11:55:13 -07:00
src Use cleaner references to STL classes 2023-11-16 10:51:20 -08:00
tests Merge pull request #551 from silvergasp/master 2023-10-21 12:29:22 -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 Update .gitignore 2017-06-20 21:11:35 -07:00
appveyor.yml Add missing build script and test script entries for appveyor. 2022-01-21 15:44:39 +01:00
CMakeLists.txt Added cmake option to disable install rules 2023-10-12 02:15:05 +04:00
LICENSE.md Update copyright year (2022 => 2023) 2023-09-06 20:39:25 -07:00
Makefile Update config=sanitize and fuzz targets 2023-10-22 10:07:52 -07:00
README.md Change badge to GHA badge. 2021-06-27 19:01:06 -07:00
readme.txt Update version to 1.14 everywhere 2023-09-07 11:55:13 -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:

Youre 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).