rapidxml

◆ clone_node()

template<class Ch = char>
xml_node< Ch > * clone_node ( const xml_node< Ch > * source,
xml_node< Ch > * result = 0 )
inline

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.

Parameters
sourceNode to clone.
resultNode to put results in, or 0 to automatically allocate result node
Returns
Pointer to cloned node. This pointer will never be NULL.

References memory_pool< Ch >::allocate_attribute(), memory_pool< Ch >::allocate_node(), memory_pool< Ch >::clone_node(), xml_node< Ch >::first_attribute(), xml_node< Ch >::first_node(), xml_base< Ch >::name(), xml_base< Ch >::name_size(), xml_node< Ch >::type(), xml_base< Ch >::value(), and xml_base< Ch >::value_size().

Referenced by memory_pool< Ch >::clone_node().