gpt4 book ai didi

c++ - 克隆 rapidxml::xml_document

转载 作者:搜寻专家 更新时间:2023-10-31 01:21:50 27 4
gpt4 key购买 nike

如何获取 RapidXML xml_document 的完整拷贝?

有一个clone_node函数;如何使用 to 创建现有文档的完整拷贝?

最佳答案

正如您已经猜到的那样,存在函数 clone_node 方法。来自联机帮助:

xml_node* clone_node(const xml_node< Ch > *source, xml_node< Ch > *result=0);

Clones an xml_node and its hierarchy of child nodes and attributes. Nodes and attributes are allocated from this memory pool. Names and values are not cloned, they are shared between the clone and the source. Result node can be optionally specified as a second parameter, in which case its contents will be replaced with cloned source node. This is useful when you want to clone entire document.

FreshCode 提出的方法非常简单,但会为“toString & parseBack”增加不必要的开销,您可能希望避免。

关于c++ - 克隆 rapidxml::xml_document,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3504142/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com