Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CARLA simulator Carla Pugixml Interface

From Leeroopedia
Knowledge Sources
Domains XML Parsing, Data Serialization
Last Updated 2026-02-15 05:00 GMT

Overview

pugixml.hpp is the public interface header for the pugixml XML parser library (version 1.9), declaring all types, classes, and functions for XML parsing, DOM manipulation, and XPath evaluation.

Description

This header (~1464 lines) defines the complete public API of the pugixml library including: xml_document, xml_node, xml_attribute, xml_text for DOM tree navigation; xpath_node, xpath_node_set, xpath_query for XPath evaluation; parse mode flags; encoding detection; and output formatting options. It includes platform detection macros for PUGIXML_HAS_LONG_LONG, PUGIXML_HAS_MOVE, and PUGIXML_NOEXCEPT. A notable CARLA-specific modification disables exceptions (PUGIXML_NOEXCEPT is defined to empty) since Unreal Engine does not support C++ exceptions.

Usage

Include this header in any LibCarla source file that needs to parse or generate XML, particularly for OpenDRIVE map file processing.

Code Reference

Source Location

  • Repository: CARLA
  • File: LibCarla/source/third-party/pugixml/pugixml.hpp

Signature

// pugixml parser - version 1.9
// PUGIXML_VERSION 190

namespace pugi {
    class xml_attribute;
    class xml_node;
    class xml_text;
    class xml_node_iterator;
    class xml_attribute_iterator;
    class xml_named_node_iterator;
    class xml_tree_walker;
    class xml_document;
    class xpath_node;
    class xpath_node_set;
    class xpath_query;
    class xpath_variable_set;
}

// CARLA-specific: exceptions disabled for Unreal Engine
#define PUGIXML_NOEXCEPT

Import

#include "third-party/pugixml/pugixml.hpp"

I/O Contract

Class Purpose Key Methods
xml_document Root document container load_file(), load_string(), save(), child()
xml_node DOM node child(), children(), attribute(), text(), name()
xml_attribute Node attribute as_string(), as_int(), as_float(), as_double()
xpath_query XPath expression evaluate_boolean(), evaluate_number(), evaluate_node_set()

Usage Examples

#include "third-party/pugixml/pugixml.hpp"

pugi::xml_document doc;
doc.load_string("<root><item id='1'>Hello</item></root>");

pugi::xml_node item = doc.child("root").child("item");
int id = item.attribute("id").as_int();
const char* text = item.child_value();

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment