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

Write preorder XML Composite rows as one document. More...

#include <XmlWriter.hpp>

Inheritance diagram for MayaFlux::IO::XmlWriter:
Collaboration diagram for MayaFlux::IO::XmlWriter:

Classes

struct  Impl

Public Member Functions

bool can_write (const std::string &filepath) const override
 Accept paths with the .xml extension.
bool close () override
 Save and release the document, or return false after failure.
bool flush () override
 Save the current document, which must contain one root.
std::string get_last_error () const override
 Last structure or output error.
std::vector< std::string > get_supported_extensions () const override
 Supported extension without a dot.
bool is_open () const override
 Whether a document is being assembled.
bool open (const std::string &filepath, const Kakshya::CompositeLayout &layout) override
 Start a document using xml_composite_layout().
bool write_rows (const Kakshya::CompositeSlice &rows) override
 Append preorder rows whose parent indices are global.
 XmlWriter ()
 ~XmlWriter () override
Public Member Functions inherited from MayaFlux::IO::CompositeWriter
bool write (const std::string &filepath, const Kakshya::CompositeArray &array)
 Write a complete array in one call.
virtual ~CompositeWriter ()=default

Private Member Functions

bool write_row (const Kakshya::Composite &row)

Private Attributes

std::vector< uint64_t > m_ancestors
std::vector< bool > m_content_started
bool m_declaration_seen {}
bool m_doctype_seen {}
bool m_failed {}
std::string m_filepath
std::string m_last_error
bool m_open {}
size_t m_root_count {}
std::unique_ptr< Impl > m_xml

Detailed Description

Write preorder XML Composite rows as one document.

Rows use xml_composite_layout(). Parent indices refer to the complete row sequence across write_rows() calls. A parent must be an open ancestor; attributes must precede child content. The writer builds a DOM and saves it on flush() or close(). It preserves supported node order and values, but does not promise byte-identical output. Output is UTF-8, and a source declaration's encoding attribute is updated to UTF-8 when present.

Usage:

XmlWriter writer;
bool saved = writer.write("controls.xml", nodes);
bool write(const std::string &filepath, const Kakshya::CompositeArray &array)
Write a complete array in one call.
Note
open() creates or truncates the output path. A failed write prevents finalization. After a successful flush, later rows can still be appended and the file is updated by the next flush or close.

Definition at line 29 of file XmlWriter.hpp.


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