CFX_XMLNode* CFX_XMLElement::Clone(CFX_XMLDocument* doc) { auto* node = doc->CreateNode<CFX_XMLElement>(name_); node->attrs_ = attrs_; // TODO(dsinclair): This clone is wrong. It doesn't clone all child nodes just // text nodes? for (CFX_XMLNode* pChild = GetFirstChild(); pChild; pChild = pChild->GetNextSibling()) { if (pChild->GetType() == FX_XMLNODE_Text) node->AppendChild(pChild->Clone(doc)); } return node; }