• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

contrib/H12-Apr-2018-

docs/H03-May-2022-

scripts/H12-Apr-2018-

src/H12-Apr-2018-

tests/H12-Apr-2018-

.codecov.ymlH A D12-Apr-201816

.gitignoreH A D12-Apr-201818

.travis.ymlH A D12-Apr-2018594

LICENSE.mdH A D12-Apr-20181.1 KiB

MakefileH A D12-Apr-20182.4 KiB

README.mdH A D12-Apr-20183 KiB

appveyor.ymlH A D12-Apr-2018479

README.md

1pugixml [![Build Status](https://travis-ci.org/zeux/pugixml.svg?branch=master)](https://travis-ci.org/zeux/pugixml) [![Build status](https://ci.appveyor.com/api/projects/status/9hdks1doqvq8pwe7/branch/master?svg=true)](https://ci.appveyor.com/project/zeux/pugixml) [![codecov.io](https://codecov.io/github/zeux/pugixml/coverage.svg?branch=master)](https://codecov.io/github/zeux/pugixml?branch=master) ![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
2=======
3
4pugixml is a C++ XML processing library, which consists of a DOM-like interface with rich traversal/modification
5capabilities, an extremely fast XML parser which constructs the DOM tree from an XML file/buffer, and an XPath 1.0
6implementation for complex data-driven tree queries. Full Unicode support is also available, with Unicode interface
7variants and conversions between different Unicode encodings (which happen automatically during parsing/saving).
8
9pugixml is used by a lot of projects, both open-source and proprietary, for performance and easy-to-use interface.
10
11## Documentation
12
13Documentation for the current release of pugixml is available on-line as two separate documents:
14
15* [Quick-start guide](https://pugixml.org/docs/quickstart.html), that aims to provide enough information to start using the library;
16* [Complete reference manual](https://pugixml.org/docs/manual.html), that describes all features of the library in detail.
17
18You’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.
19
20## Example
21
22Here'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:
23
24```c++
25#include "pugixml.hpp"
26#include <iostream>
27
28int main()
29{
30    pugi::xml_document doc;
31    pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
32    if (!result)
33        return -1;
34
35    for (pugi::xml_node tool: doc.child("Profile").child("Tools").children("Tool"))
36    {
37        int timeout = tool.attribute("Timeout").as_int();
38
39        if (timeout > 0)
40            std::cout << "Tool " << tool.attribute("Filename").value() << " has timeout " << timeout << "\n";
41    }
42}
43```
44
45And the same example using XPath:
46
47```c++
48#include "pugixml.hpp"
49#include <iostream>
50
51int main()
52{
53    pugi::xml_document doc;
54    pugi::xml_parse_result result = doc.load_file("xgconsole.xml");
55    if (!result)
56        return -1;
57
58    pugi::xpath_node_set tools_with_timeout = doc.select_nodes("/Profile/Tools/Tool[@Timeout > 0]");
59
60    for (pugi::xpath_node node: tools_with_timeout)
61    {
62        pugi::xml_node tool = node.node();
63        std::cout << "Tool " << tool.attribute("Filename").value() <<
64            " has timeout " << tool.attribute("Timeout").as_int() << "\n";
65    }
66}
67```
68
69
70## License
71
72This library is available to anybody free of charge, under the terms of MIT License (see LICENSE.md).
73