mcpp index

compat.pugixml

#include

Light-weight, simple and fast XML parser for C++ with XPath support

#include <pugixml.hpp>
mcpp add compat.pugixml@1.16

用法

來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。

#include <cstdio>
#include <sstream>
#include <string>

#include <pugixml.hpp>

static_assert(PUGIXML_VERSION == 1160, "expected pugixml 1.16 headers");

int main() {
    bool ok = true;

    const char *xml = R"(<?xml version="1.0" encoding="UTF-8"?>
<catalog>
  <book id="1" price="19.99"><title>Alpha</title></book>
  <book id="2" price="29.50"><title>Beta</title></book>
</catalog>)";

    pugi::xml_document doc;
    pugi::xml_parse_result res = doc.load_string(xml);
    if (!res) {
        std::fprintf(stderr, "pugixml load_string failed: %s\n", res.description());
        return 1;
// …

tests/examples/pugixml/tests/test_pugixml.cpp · 專案 tests/examples/pugixml

建置

targets
pugixml (lib)
language
c++23
import std
no
include dirs
*/src

原始檔 (1)

  • */src/pugixml.cpp

版本

版本平台 鏡像sha256
1.16 最新 LinuxWindowsmacOS CN GLOBAL 357bcab8877d…