MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::IO::XmlDocument Class Reference

A parsed XML document that owns its rows and hierarchy. More...

#include <XmlDocument.hpp>

Collaboration diagram for MayaFlux::IO::XmlDocument:

Public Member Functions

std::optional< XmlElementView > element_at (uint64_t row) const noexcept
 Borrow an element by its row index.
const Kakshya::CompositeForest & forest () const noexcept
 The rows together with their parent index.
std::optional< XmlElementView > root_element () const noexcept
 Borrow the document root element.

Static Public Member Functions

static std::shared_ptr< const XmlDocument > from_rows (Kakshya::CompositeArray rows, std::string &error)
 Take ownership of rows in the XML node layout.
static std::shared_ptr< const XmlDocument > load (const std::string &path, std::string &error)
 Parse a file into an owning document.

Private Member Functions

 XmlDocument (std::shared_ptr< const Kakshya::CompositeForest > forest) noexcept

Private Attributes

std::shared_ptr< const Kakshya::CompositeForest > m_forest

Detailed Description

A parsed XML document that owns its rows and hierarchy.

Reads a file once and keeps the preorder Composite rows with their parent index, so element views stay valid for as long as the document lives and no reader has to stay open. Any consumer can bind described records from the views, walk the forest, or select a branch as a Region. The document is immutable and shared.

Usage:

std::string error;
auto document = XmlDocument::load("scene.xml", error);
if (document) {
auto root = document->root_element();
auto branch = document->forest().subtree_region(3);
}
static std::shared_ptr< const XmlDocument > load(const std::string &path, std::string &error)
Parse a file into an owning document.

Definition at line 29 of file XmlDocument.hpp.


The documentation for this class was generated from the following files: