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

Read an XML document into preorder Composite rows. More...

#include <XmlReader.hpp>

Inheritance diagram for MayaFlux::IO::XmlReader:
Collaboration diagram for MayaFlux::IO::XmlReader:

Public Member Functions

bool can_read (const std::string &filepath) const override
 Accept paths with the .xml extension.
void close () override
 Release parsed rows and reset the read position.
std::optional< XmlElementView > element_at (uint64_t row) const noexcept
 Borrow an element by its global XML row index.
std::vector< uint64_t > get_dimension_sizes () const override
 Total number of rows while open.
std::optional< Kakshya::CompositeLayout > get_layout () const override
 Copy the finalized node layout while open.
std::optional< FileMetadata > get_metadata () const override
 XML format, MIME type, and source file size.
size_t get_num_dimensions () const override
 The document is exposed as one row axis.
uint64_t get_preferred_chunk_size () const override
 Suggested size for bounded Composite copies.
std::vector< uint64_t > get_read_position () const override
 Global index of the next row.
std::vector< FileRegion > get_regions () const override
 XML nodes do not declare FileRegion values.
std::vector< std::string > get_supported_extensions () const override
 Supported extension without a dot.
bool is_open () const override
 Whether parsed rows are available.
bool open (const std::string &filepath, FileReadOptions options=FileReadOptions::ALL) override
 Parse an XML file and establish the fixed node layout.
std::optional< Kakshya::CompositeArray > read_composite () override
 Copy all rows remaining after the current position.
std::optional< Kakshya::CompositeArray > read_next (size_t max_elements) override
 Copy at most max_elements rows and advance the position.
std::optional< XmlElementView > root_element () const noexcept
 Borrow the document root element, independent of the row read position.
const Kakshya::CompositeArray * rows_view () const noexcept
 Borrow the parsed XML rows while the reader remains open.
bool seek (const std::vector< uint64_t > &position) override
 Seek to one row index, including the end position.
bool supports_streaming () const override
 The parser loads the complete XML document on open().
std::optional< Kakshya::CompositeArray > take_rows ()
 Move the parsed rows out and close the reader.
Public Member Functions inherited from MayaFlux::IO::CompositeReader
std::shared_ptr< Kakshya::CompositeContainer > create_composite_container (size_t batch_size=1)
 Read remaining elements into a new CompositeContainer.
std::shared_ptr< Kakshya::SignalSourceContainer > create_container () override
 CompositeContainer is not a SignalSourceContainer.
std::type_index get_container_type () const override
 Get the container type this reader creates.
std::type_index get_data_type () const override
 Get the data type this reader produces.
std::string get_last_error () const override
 Get the last error message.
bool load_into_container (std::shared_ptr< Kakshya::SignalSourceContainer >) override
 CompositeContainer is not a SignalSourceContainer.
std::vector< Kakshya::DataVariant > read_all () override
 Composite data is not a DataVariant channel vector.
std::optional< Kakshya::CompositeArray > read_composite_region (const FileRegion &region)
 Read an inclusive one-dimensional file region.
std::vector< Kakshya::DataVariant > read_region (const FileRegion &) override
 Use read_composite_region() for a schema-bearing result.
 ~CompositeReader () override=default
Public Member Functions inherited from MayaFlux::IO::FileReader
virtual ~FileReader ()=default

Private Attributes

std::string m_filepath
std::optional< Kakshya::ForestIndex > m_forest
uint64_t m_position {}
std::optional< Kakshya::CompositeArray > m_rows

Additional Inherited Members

Static Public Member Functions inherited from MayaFlux::IO::FileReader
static std::string resolve_path (const std::string &filepath)
 Resolve a filepath against the project source root if not found as-is.
Static Protected Member Functions inherited from MayaFlux::IO::FileReader
static std::unordered_map< std::string, Kakshya::RegionGroup > regions_to_groups (const std::vector< FileRegion > &regions)
 Convert file regions to region groups.
Protected Attributes inherited from MayaFlux::IO::CompositeReader
std::string m_last_error

Detailed Description

Read an XML document into preorder Composite rows.

The complete document is parsed on open(). Bounded reads copy rows from that owning array and retain global parent indices. This is not streaming XML input. Parsed character data, CDATA, comments, processing instructions, declarations, and doctypes remain separate rows. Entity references are expanded by pugixml, so the result preserves document semantics rather than original source bytes.

Usage:

XmlReader reader;
if (reader.open("controls.xml")) {
auto layout = reader.get_layout();
auto nodes = reader.read_composite();
}
bool open(const std::string &filepath, FileReadOptions options=FileReadOptions::ALL) override
Parse an XML file and establish the fixed node layout.
std::optional< Kakshya::CompositeArray > read_composite() override
Copy all rows remaining after the current position.
std::optional< Kakshya::CompositeLayout > get_layout() const override
Copy the finalized node layout while open.
Read an XML document into preorder Composite rows.
Note
The input limit is 64 MiB, one million rows, and 256 element levels. A batch is not a standalone document because its parent indices refer to the complete preorder sequence.

Definition at line 132 of file XmlReader.hpp.


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