MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ load()

std::shared_ptr< const XmlDocument > MayaFlux::IO::XmlDocument::load ( const std::string & path,
std::string & error )
staticnodiscard

Parse a file into an owning document.

Parameters
errorReceives the reason when nullptr is returned.

Definition at line 5 of file XmlDocument.cpp.

6{
7 XmlReader reader;
8 if (!reader.open(path)) {
9 error = reader.get_last_error();
10 return nullptr;
11 }
12 auto rows = reader.take_rows();
13 if (!rows) {
14 error = "No XML rows were parsed";
15 return nullptr;
16 }
17 return from_rows(std::move(*rows), error);
18}
static std::shared_ptr< const XmlDocument > from_rows(Kakshya::CompositeArray rows, std::string &error)
Take ownership of rows in the XML node layout.
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.

References from_rows(), MayaFlux::IO::CompositeReader::get_last_error(), MayaFlux::IO::XmlReader::open(), and MayaFlux::IO::XmlReader::take_rows().

Referenced by MayaFlux::Portal::Forma::instantiate_xml().

Here is the call graph for this function:
Here is the caller graph for this function: