Skip to content
Snippets Groups Projects
Commit b4be9b0f authored by Jose Luis Vazquez-Garcia's avatar Jose Luis Vazquez-Garcia
Browse files

How to load an XML file into a Hash

parent 92992ffc
Branches feat/dynamic-manager
No related tags found
No related merge requests found
Pipeline #164373 passed
.. _loadfile:
**************************************
Loading an xml file into a Karabo Hash
**************************************
The next code example shows hot to load the content of an XML file into a Karabo
Hash:
.. code-block:: c++
// We assume the file is inside the Karabo installation
std::string file_path(karabo::util::Version::getPathToKaraboInstallation() + "/var/data/my_file.xml");
try {
Hash config;
Input<Hash>::Pointer input = Input<Hash>::create("TextFile", Hash("filename", file_path));
input->read(config);
} catch (std::exception& e) {
KARABO_LOG_FRAMEWORK_WARN << "Failed to load File: " << file_path << " : " << e.what();
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment