diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.cpp b/libgnucash/backend/xml/sixtp-dom-parsers.cpp index bd2f4ed9b4..2619858462 100644 --- a/libgnucash/backend/xml/sixtp-dom-parsers.cpp +++ b/libgnucash/backend/xml/sixtp-dom-parsers.cpp @@ -35,6 +35,15 @@ static QofLogModule log_module = GNC_MOD_IO; +const char* +dom_node_to_text (xmlNodePtr node) noexcept +{ + if (node && node->children && node->children->type == XML_TEXT_NODE + && !node->children->next) + return reinterpret_cast(node->children->content); + return nullptr; +} + std::optional dom_tree_to_guid (xmlNodePtr node) { diff --git a/libgnucash/backend/xml/sixtp-dom-parsers.h b/libgnucash/backend/xml/sixtp-dom-parsers.h index d23ae63606..37083438d9 100644 --- a/libgnucash/backend/xml/sixtp-dom-parsers.h +++ b/libgnucash/backend/xml/sixtp-dom-parsers.h @@ -45,6 +45,7 @@ gboolean dom_tree_valid_time64 (time64 ts, const xmlChar* name); GDate* dom_tree_to_gdate (xmlNodePtr node); gnc_numeric dom_tree_to_gnc_numeric (xmlNodePtr node); gchar* dom_tree_to_text (xmlNodePtr tree); +const char* dom_node_to_text (xmlNodePtr node) noexcept; gboolean string_to_binary (const gchar* str, void** v, guint64* data_len); gboolean dom_tree_create_instance_slots (xmlNodePtr node, QofInstance* inst);