Skip to content

Commit

Permalink
correct xml import method
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed Apr 28, 2024
1 parent ab7d919 commit 8ae7212
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions libtascar/include/tscconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ namespace tsccfg {
std::string node_get_text(tsccfg::node_t& n, const std::string& child = "");
void node_set_text(tsccfg::node_t& n, const std::string& text);
void node_import_node(tsccfg::node_t& node, const tsccfg::node_t& src);
void node_import_node_before(tsccfg::node_t& node, const tsccfg::node_t& src, const tsccfg::node_t& before);

// double node_xpath_to_number(tsccfg::node_t&,const std::string& path);

Expand Down
2 changes: 1 addition & 1 deletion libtascar/src/session_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void add_includes(tsccfg::node_t e, const std::string& parentdoc,
TASCAR::tscbasename(idocname));
add_includes(idoc.root(), idocname, lh);
for(auto& isne : idoc.root.get_children())
tsccfg::node_import_node(e, isne);
tsccfg::node_import_node_before(e, isne, sne);
tsccfg::node_remove_child(e, sne);
}
} else {
Expand Down
12 changes: 12 additions & 0 deletions libtascar/src/tscconfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,18 @@ void tsccfg::node_import_node(tsccfg::node_t& node, const tsccfg::node_t& src)
#endif
}

void tsccfg::node_import_node_before(tsccfg::node_t& node, const tsccfg::node_t& src, const tsccfg::node_t& before)
{
#ifdef USEPUGIXML
node.append_copy(src);
#elif defined(USEXERCESXML)
auto impnode(node->getOwnerDocument()->importNode(src, true));
node->insertBefore(impnode,before);
#else
node->import_node(src);
#endif
}

std::string tsccfg::node_get_attribute_value(const tsccfg::node_t& node,
const std::string& name)
{
Expand Down

0 comments on commit 8ae7212

Please sign in to comment.