diff --git a/include/openmc/xml_interface.h b/include/openmc/xml_interface.h index 85db26faa3..8bf0f21749 100644 --- a/include/openmc/xml_interface.h +++ b/include/openmc/xml_interface.h @@ -50,5 +50,12 @@ xt::xarray get_node_xarray(pugi::xml_node node, const char* name, return xt::adapt(v, shape); } +//=============================================================================== +// GET_NODE_LIST is used to get a pointer to a list of sub-element nodes +//=============================================================================== + +std::vector +get_child_nodes(pugi::xml_node node, const char* name); + } // namespace openmc #endif // OPENMC_XML_INTERFACE_H diff --git a/src/xml_interface.cpp b/src/xml_interface.cpp index 60ae7ffcab..c9b7bbcab3 100644 --- a/src/xml_interface.cpp +++ b/src/xml_interface.cpp @@ -56,4 +56,20 @@ get_node_value_bool(pugi::xml_node node, const char* name) return false; } + + +std::vector +get_child_nodes(pugi::xml_node node, const char* name) +{ + pugi::xml_node current; + std::vector node_list; + + for (pugi::xml_node current : node.children(name)) { + node_list.push_back(current); + } + + return node_list; +} + + } // namespace openmc